Class: Igniter::Lang::Types::Descriptor
- Inherits:
-
Object
- Object
- Igniter::Lang::Types::Descriptor
- Defined in:
- lib/igniter/lang/types.rb
Instance Attribute Summary collapse
-
#dimensions ⇒ Object
readonly
Returns the value of attribute dimensions.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#of ⇒ Object
readonly
Returns the value of attribute of.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(kind:, of:, dimensions: {}, metadata: {}) ⇒ Descriptor
constructor
A new instance of Descriptor.
- #inspect ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(kind:, of:, dimensions: {}, metadata: {}) ⇒ Descriptor
Returns a new instance of Descriptor.
9 10 11 12 13 14 15 |
# File 'lib/igniter/lang/types.rb', line 9 def initialize(kind:, of:, dimensions: {}, metadata: {}) @kind = kind.to_sym @of = of @dimensions = dimensions.transform_keys(&:to_sym).freeze @metadata = .transform_keys(&:to_sym).freeze freeze end |
Instance Attribute Details
#dimensions ⇒ Object (readonly)
Returns the value of attribute dimensions.
7 8 9 |
# File 'lib/igniter/lang/types.rb', line 7 def dimensions @dimensions end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
7 8 9 |
# File 'lib/igniter/lang/types.rb', line 7 def kind @kind end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/igniter/lang/types.rb', line 7 def @metadata end |
#of ⇒ Object (readonly)
Returns the value of attribute of.
7 8 9 |
# File 'lib/igniter/lang/types.rb', line 7 def of @of end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
30 31 32 |
# File 'lib/igniter/lang/types.rb', line 30 def ==(other) other.is_a?(self.class) && to_h == other.to_h end |
#hash ⇒ Object
35 36 37 |
# File 'lib/igniter/lang/types.rb', line 35 def hash to_h.hash end |
#inspect ⇒ Object
26 27 28 |
# File 'lib/igniter/lang/types.rb', line 26 def inspect "#<#{self.class.name} #{to_h.inspect}>" end |
#to_h ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/igniter/lang/types.rb', line 17 def to_h { kind: kind, of: serialize_type(of), dimensions: serialize_dimensions, metadata: } end |