Module: Supa::Representable::InstanceMethods
- Defined in:
- lib/supa/representable.rb
Instance Attribute Summary collapse
-
#representee ⇒ Object
readonly
Returns the value of attribute representee.
Instance Method Summary collapse
Instance Attribute Details
#representee ⇒ Object (readonly)
Returns the value of attribute representee.
23 24 25 |
# File 'lib/supa/representable.rb', line 23 def representee @representee end |
Instance Method Details
#initialize(representee) ⇒ Object
9 10 11 |
# File 'lib/supa/representable.rb', line 9 def initialize(representee) @representee = representee end |
#to_hash ⇒ Object
13 14 15 16 17 |
# File 'lib/supa/representable.rb', line 13 def to_hash Supa::Builder.new(representee, representer: self, tree: {}).tap do |builder| builder.instance_exec(&self.class.definition) end.to_hash end |
#to_json ⇒ Object
19 20 21 |
# File 'lib/supa/representable.rb', line 19 def to_json to_hash.to_json end |