Class: Oat::Adapters::Siren::Action
- Inherits:
-
Object
- Object
- Oat::Adapters::Siren::Action
- Defined in:
- lib/oat/adapters/siren.rb
Defined Under Namespace
Classes: Field
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #field(name, &block) ⇒ Object
-
#initialize(name) ⇒ Action
constructor
A new instance of Action.
- #klass(value) ⇒ Object
Constructor Details
#initialize(name) ⇒ Action
Returns a new instance of Action.
69 70 71 |
# File 'lib/oat/adapters/siren.rb', line 69 def initialize(name) @data = { :name => name, :class => [], :fields => [] } end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
67 68 69 |
# File 'lib/oat/adapters/siren.rb', line 67 def data @data end |
Instance Method Details
#field(name, &block) ⇒ Object
77 78 79 80 81 82 |
# File 'lib/oat/adapters/siren.rb', line 77 def field(name, &block) field = Field.new(name) block.call(field) data[:fields] << field.data end |
#klass(value) ⇒ Object
73 74 75 |
# File 'lib/oat/adapters/siren.rb', line 73 def klass(value) data[:class] << value end |