Class: Tros::Schema::NamedSchema
- Inherits:
-
Tros::Schema
- Object
- Tros::Schema
- Tros::Schema::NamedSchema
- Defined in:
- lib/tros/schema.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Tros::Schema
INT_MAX_VALUE, INT_MIN_VALUE, LONG_MAX_VALUE, LONG_MIN_VALUE, NAMED_TYPES, NAMED_TYPES_SYM, PRIMITIVE_TYPES, PRIMITIVE_TYPES_SYM, VALID_TYPES, VALID_TYPES_SYM
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Attributes inherited from Tros::Schema
Instance Method Summary collapse
- #fullname ⇒ Object
-
#initialize(type, name, namespace = nil, names = nil) ⇒ NamedSchema
constructor
A new instance of NamedSchema.
- #to_avro(names = Set.new) ⇒ Object
Methods inherited from Tros::Schema
#==, #hash, parse, real_parse, #subparse, #to_s, #type, validate, validate_strictly
Constructor Details
#initialize(type, name, namespace = nil, names = nil) ⇒ NamedSchema
Returns a new instance of NamedSchema.
182 183 184 185 186 |
# File 'lib/tros/schema.rb', line 182 def initialize(type, name, namespace=nil, names=nil) super(type) @name, @namespace = Name.extract_namespace(name, namespace) names = Name.add_name(names, self) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
181 182 183 |
# File 'lib/tros/schema.rb', line 181 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
181 182 183 |
# File 'lib/tros/schema.rb', line 181 def namespace @namespace end |
Instance Method Details
#fullname ⇒ Object
198 199 200 |
# File 'lib/tros/schema.rb', line 198 def fullname @fullname ||= Name.make_fullname(@name, @namespace) end |
#to_avro(names = Set.new) ⇒ Object
188 189 190 191 192 193 194 195 196 |
# File 'lib/tros/schema.rb', line 188 def to_avro(names=Set.new) if @name return fullname if names.include?(fullname) names << fullname end props = {'name' => @name} props.merge!('namespace' => @namespace) if @namespace super.merge props end |