Class: Icss::Meta::RecordField
- Includes:
- Gorillib::Hashlike, Gorillib::Hashlike::Keys, RecordModel, ReceiverModel, ReceiverModel::ActiveModelShim, ReceiverModel::ActsAsHash
- Defined in:
- lib/icss/type/record_field.rb
Constant Summary collapse
- ALLOWED_ORDERS =
%w[ascending descending ignore].freeze
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
-
#is_reference? ⇒ Boolean
is the field a reference to a named type (true), or an inline schema (false)?.
-
#merge(hsh) ⇒ Object
Hack hack – makes it so fields go thru the receiver door when merged in RecordType.
-
#order ⇒ Object
Order is defined by the avro spec.
- #order_direction ⇒ Object
- #to_hash ⇒ Object
- #to_schema ⇒ Object
Methods included from ReceiverModel::ActiveModelShim
#destroyed?, #errors, included, #new_record?, #to_model
Methods included from ReceiverModel
Methods included from ReceiverModel::ActsAsTuple
Methods included from RecordModel
#attr_set?, included, #receive!, #to_zaml
Methods included from ReceiverModel::ActsAsLoadable
Methods included from ReceiverModel::ActsAsHash
#[], #[]=, #attributes, #delete, included, #keys
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
27 28 29 |
# File 'lib/icss/type/record_field.rb', line 27 def parent @parent end |
Instance Method Details
#is_reference? ⇒ Boolean
is the field a reference to a named type (true), or an inline schema (false)?
47 |
# File 'lib/icss/type/record_field.rb', line 47 def is_reference?() @is_reference ; end |
#merge(hsh) ⇒ Object
Hack hack – makes it so fields go thru the receiver door when merged in RecordType
60 61 62 |
# File 'lib/icss/type/record_field.rb', line 60 def merge(hsh) dup.receive!(hsh) end |
#order ⇒ Object
Order is defined by the avro spec
65 |
# File 'lib/icss/type/record_field.rb', line 65 def order() @order || 'ascending' ; end |
#order_direction ⇒ Object
66 |
# File 'lib/icss/type/record_field.rb', line 66 def order_direction() case order when 'ascending' then 1 when 'descending' then -1 else 0 ; end ; end |
#to_hash ⇒ Object
49 50 51 52 53 54 |
# File 'lib/icss/type/record_field.rb', line 49 def to_hash() hsh = super hsh = hsh.merge({ :type => (is_reference? ? type.fullname : Type.schema_for(type)) }) hsh.delete(:_extra_params) hsh end |
#to_schema ⇒ Object
55 56 57 |
# File 'lib/icss/type/record_field.rb', line 55 def to_schema to_hash end |