Module: HalApi::Representer::FormatKeys::ClassMethods

Defined in:
lib/hal_api/representer/format_keys.rb

Instance Method Summary collapse

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, options={})
  n = (options[:as] || name).to_s
  options[:as] = options[:embedded] ? n.dasherize : n.camelize(:lower)
  super(name, options)
end


10
11
12
13
14
# File 'lib/hal_api/representer/format_keys.rb', line 10

def link(options, &block)
  options = {:rel => options} unless options.is_a?(Hash)
  options[:rel] = options[:rel].to_s.dasherize
  super(options, &block)
end

#property(name, options = {}) ⇒ Object



16
17
18
19
20
# File 'lib/hal_api/representer/format_keys.rb', line 16

def property(name, options={})
  n = (options[:as] || name).to_s
  options[:as] = options[:embedded] ? n.dasherize : n.camelize(:lower)
  super(name, options)
end