Sha256: cd40102b31581e94d00fd2724d33d938a29ab4db50278dcfe0cbf9758d2b2c4c
Contents?: true
Size: 849 Bytes
Versions: 33
Compression:
Stored size: 849 Bytes
Contents
require 'active_support/concern' # Link relation names seem to have a standard of being dasherized, as they are URIs # property names, on the other hand should, should be camelcase, lower first module HalApi::Representer::FormatKeys extend ActiveSupport::Concern module ClassMethods def link(options, &block) options = {:rel => options} unless options.is_a?(Hash) options[:rel] = options[:rel].to_s.dasherize super(options, &block) end def property(name, options={}) n = (options[:as] || name).to_s options[:as] = options[:embedded] ? n.dasherize : n.camelize(:lower) super(name, options) end def collection(name, options={}) n = (options[:as] || name).to_s options[:as] = options[:embedded] ? n.dasherize : n.camelize(:lower) super(name, options) end end end
Version data entries
33 entries across 33 versions & 1 rubygems