Class: Avro::Schema::Field
- Inherits:
-
Avro::Schema
- Object
- Avro::Schema
- Avro::Schema::Field
- Defined in:
- lib/avro/schema.rb
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
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Avro::Schema
Instance Method Summary collapse
-
#initialize(type, name, default = nil, order = nil, names = nil, namespace = nil) ⇒ Field
constructor
A new instance of Field.
- #to_avro(names = Set.new) ⇒ Object
Methods inherited from Avro::Schema
#==, #hash, #md5_fingerprint, parse, real_parse, #sha256_fingerprint, #subparse, #to_s, #type_adapter, validate
Constructor Details
#initialize(type, name, default = nil, order = nil, names = nil, namespace = nil) ⇒ Field
Returns a new instance of Field.
383 384 385 386 387 388 |
# File 'lib/avro/schema.rb', line 383 def initialize(type, name, default=nil, order=nil, names=nil, namespace=nil) @type = subparse(type, names, namespace) @name = name @default = default @order = order end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
381 382 383 |
# File 'lib/avro/schema.rb', line 381 def default @default end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
381 382 383 |
# File 'lib/avro/schema.rb', line 381 def name @name end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
381 382 383 |
# File 'lib/avro/schema.rb', line 381 def order @order end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
381 382 383 |
# File 'lib/avro/schema.rb', line 381 def type @type end |
Instance Method Details
#to_avro(names = Set.new) ⇒ Object
390 391 392 393 394 395 |
# File 'lib/avro/schema.rb', line 390 def to_avro(names=Set.new) {'name' => name, 'type' => type.to_avro(names)}.tap do |avro| avro['default'] = default if default avro['order'] = order if order end end |