Module: Darstellung::Macros
- Defined in:
- lib/darstellung/macros.rb
Overview
This module provides all the class level macros for defining representations.
Instance Method Summary collapse
-
#detail(name, options = {}, &block) ⇒ Attribute
Defines an attribute to be displayed in the detail representation of the resource.
-
#detail_attributes ⇒ Hash
Get all the attributes that are used in the detail representation.
-
#summary(name, options = {}, &block) ⇒ Attribute
Defines an attribute to be displayed in the summary representation of the resource.
-
#summary_attributes ⇒ Hash
Get all the attributes that are used in the summary representation.
Instance Method Details
#detail(name, options = {}, &block) ⇒ Attribute
Defines an attribute to be displayed in the detail representation of the resource.
51 52 53 |
# File 'lib/darstellung/macros.rb', line 51 def detail(name, = {}, &block) create_attribute(name, detail_attributes, , &block) end |
#detail_attributes ⇒ Hash
Get all the attributes that are used in the detail representation.
67 68 69 |
# File 'lib/darstellung/macros.rb', line 67 def detail_attributes @detail_attributes ||= {} end |
#summary(name, options = {}, &block) ⇒ Attribute
Defines an attribute to be displayed in the summary representation of the resource.
110 111 112 |
# File 'lib/darstellung/macros.rb', line 110 def summary(name, = {}, &block) create_attribute(name, summary_attributes, , &block) end |
#summary_attributes ⇒ Hash
Get all the attributes that are used in the summary representation.
126 127 128 |
# File 'lib/darstellung/macros.rb', line 126 def summary_attributes @summary_attributes ||= {} end |