Sha256: af607de22b327d9cbfda3d81a0b195bee38455d8d1efe6be4d3a18aa5ff78cd4
Contents?: true
Size: 607 Bytes
Versions: 10
Compression:
Stored size: 607 Bytes
Contents
class RestModel class Property module Builder def property(name, options = {}) options[:validate] = !options[:validate_if_present] key Property.new(name, options) end def properties(*args) options = options(args) names = args names.each {|name| property(name, options)} end def id(*args) options = options(args) name = args.fetch(0, :id) property(name, options.merge(id: true)) end private def options(args) args.last.kind_of?(Hash) ? args.pop : {} end end end end
Version data entries
10 entries across 10 versions & 1 rubygems