Class: Tros::Schema::FixedSchema
- Inherits:
-
NamedSchema
- Object
- Tros::Schema
- NamedSchema
- Tros::Schema::FixedSchema
- Defined in:
- lib/tros/schema.rb
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
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from NamedSchema
Attributes inherited from Tros::Schema
Instance Method Summary collapse
-
#initialize(name, space, size, names = nil) ⇒ FixedSchema
constructor
A new instance of FixedSchema.
- #to_avro(names = Set.new) ⇒ Object
Methods inherited from NamedSchema
Methods inherited from Tros::Schema
#==, #hash, parse, real_parse, #subparse, #to_s, #type, validate, validate_strictly
Constructor Details
#initialize(name, space, size, names = nil) ⇒ FixedSchema
Returns a new instance of FixedSchema.
346 347 348 349 350 351 |
# File 'lib/tros/schema.rb', line 346 def initialize(name, space, size, names=nil) # Ensure valid cto args raise AvroError, 'Fixed Schema requires a valid integer for size property.' unless size.is_a?(Integer) super(:fixed, name, space, names) @size = size end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
345 346 347 |
# File 'lib/tros/schema.rb', line 345 def size @size end |
Instance Method Details
#to_avro(names = Set.new) ⇒ Object
353 354 355 356 |
# File 'lib/tros/schema.rb', line 353 def to_avro(names=Set.new) tros = super tros.is_a?(Hash) ? tros.merge('size' => size) : tros end |