Class: Avro::Schema::FixedSchema
- Inherits:
-
NamedSchema
- Object
- Avro::Schema
- NamedSchema
- Avro::Schema::FixedSchema
- 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
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from NamedSchema
Attributes inherited from Avro::Schema
Instance Method Summary collapse
-
#initialize(name, space, size, names = nil, logical_type = nil) ⇒ FixedSchema
constructor
A new instance of FixedSchema.
- #to_avro(names = Set.new) ⇒ Object
Methods inherited from NamedSchema
Methods inherited from Avro::Schema
#==, #hash, #md5_fingerprint, parse, real_parse, #sha256_fingerprint, #subparse, #to_s, #type, #type_adapter, validate
Constructor Details
#initialize(name, space, size, names = nil, logical_type = nil) ⇒ FixedSchema
Returns a new instance of FixedSchema.
365 366 367 368 369 370 371 372 |
# File 'lib/avro/schema.rb', line 365 def initialize(name, space, size, names=nil, logical_type=nil) # Ensure valid cto args unless size.is_a?(Fixnum) || size.is_a?(Bignum) raise AvroError, 'Fixed Schema requires a valid integer for size property.' end super(:fixed, name, space, names, logical_type) @size = size end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
364 365 366 |
# File 'lib/avro/schema.rb', line 364 def size @size end |
Instance Method Details
#to_avro(names = Set.new) ⇒ Object
374 375 376 377 |
# File 'lib/avro/schema.rb', line 374 def to_avro(names=Set.new) avro = super avro.is_a?(Hash) ? avro.merge('size' => size) : avro end |