Class: Avro::Schema::NamedSchema
- Inherits:
-
Avro::Schema
- Object
- Avro::Schema
- Avro::Schema::NamedSchema
- Defined in:
- lib/avro/schema.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Avro::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 Avro::Schema
Instance Method Summary collapse
- #fullname ⇒ Object
-
#initialize(type, name, namespace = nil, names = nil, logical_type = nil) ⇒ NamedSchema
constructor
A new instance of NamedSchema.
- #to_avro(names = Set.new) ⇒ Object
Methods inherited from Avro::Schema
#==, #hash, #md5_fingerprint, parse, real_parse, #sha256_fingerprint, #subparse, #to_s, #type, #type_adapter, validate
Constructor Details
#initialize(type, name, namespace = nil, names = nil, logical_type = nil) ⇒ NamedSchema
Returns a new instance of NamedSchema.
201 202 203 204 205 |
# File 'lib/avro/schema.rb', line 201 def initialize(type, name, namespace=nil, names=nil, logical_type=nil) super(type, logical_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.
200 201 202 |
# File 'lib/avro/schema.rb', line 200 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
200 201 202 |
# File 'lib/avro/schema.rb', line 200 def namespace @namespace end |
Instance Method Details
#fullname ⇒ Object
217 218 219 |
# File 'lib/avro/schema.rb', line 217 def fullname @fullname ||= Name.make_fullname(@name, @namespace) end |
#to_avro(names = Set.new) ⇒ Object
207 208 209 210 211 212 213 214 215 |
# File 'lib/avro/schema.rb', line 207 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 |