Class: Shaf::ALPS::AttributeSerializer
- Inherits:
-
Object
- Object
- Shaf::ALPS::AttributeSerializer
- Defined in:
- lib/shaf/alps/attribute_serializer.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attribute) ⇒ AttributeSerializer
constructor
A new instance of AttributeSerializer.
- #to_hash ⇒ Object
Constructor Details
#initialize(attribute) ⇒ AttributeSerializer
Returns a new instance of AttributeSerializer.
12 13 14 |
# File 'lib/shaf/alps/attribute_serializer.rb', line 12 def initialize(attribute) @attribute = attribute end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
6 7 8 |
# File 'lib/shaf/alps/attribute_serializer.rb', line 6 def attribute @attribute end |
Class Method Details
.call(arg) ⇒ Object
8 9 10 |
# File 'lib/shaf/alps/attribute_serializer.rb', line 8 def self.call(arg) new(arg).to_hash end |
Instance Method Details
#to_hash ⇒ Object
16 17 18 19 20 21 |
# File 'lib/shaf/alps/attribute_serializer.rb', line 16 def to_hash { id: attribute.id, type: 'semantic', }.merge(optional_properties) end |