Module: Halogen::InstanceMethods
- Defined in:
- lib/halogen.rb
Overview
:nodoc:
Instance Method Summary collapse
- #collection? ⇒ Boolean
-
#depth ⇒ Integer
The depth at which this representer is embedded.
-
#initialize(options = {}) ⇒ Object
The representer instance.
-
#parent ⇒ nil, Object
The parent representer, if this instance is an embedded child.
-
#render ⇒ Hash
Rendered representation.
-
#to_json ⇒ String
Rendered JSON.
Instance Method Details
#collection? ⇒ Boolean
95 96 97 |
# File 'lib/halogen.rb', line 95 def collection? false end |
#depth ⇒ Integer
Returns the depth at which this representer is embedded.
91 92 93 |
# File 'lib/halogen.rb', line 91 def depth @depth ||= parent ? parent.depth + 1 : 0 end |
#initialize(options = {}) ⇒ Object
Returns the representer instance.
66 67 68 |
# File 'lib/halogen.rb', line 66 def initialize( = {}) @options = Halogen::HashUtil.symbolize_keys!() end |
#parent ⇒ nil, Object
Returns the parent representer, if this instance is an embedded child.
85 86 87 |
# File 'lib/halogen.rb', line 85 def parent @parent ||= .fetch(:parent, nil) end |
#render ⇒ Hash
Returns rendered representation.
78 79 80 |
# File 'lib/halogen.rb', line 78 def render {} end |
#to_json ⇒ String
Returns rendered JSON.
72 73 74 |
# File 'lib/halogen.rb', line 72 def to_json render.to_json end |