Module: HalApi::Representer::FormatKeys::ClassMethods
- Defined in:
- lib/hal_api/representer/format_keys.rb
Instance Method Summary collapse
- #collection(name, options = {}) ⇒ Object
- #link(options, &block) ⇒ Object
- #property(name, options = {}) ⇒ Object
Instance Method Details
#collection(name, options = {}) ⇒ Object
22 23 24 25 26 |
# File 'lib/hal_api/representer/format_keys.rb', line 22 def collection(name, ={}) n = ([:as] || name).to_s [:as] = [:embedded] ? n.dasherize : n.camelize(:lower) super(name, ) end |
#link(options, &block) ⇒ Object
10 11 12 13 14 |
# File 'lib/hal_api/representer/format_keys.rb', line 10 def link(, &block) = {:rel => } unless .is_a?(Hash) [:rel] = [:rel].to_s.dasherize super(, &block) end |
#property(name, options = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/hal_api/representer/format_keys.rb', line 16 def property(name, ={}) n = ([:as] || name).to_s [:as] = [:embedded] ? n.dasherize : n.camelize(:lower) super(name, ) end |