Class: Shaf::ALPS::AttributeSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/shaf/alps/attribute_serializer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#attributeObject (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_hashObject



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