Sha256: cae10fa6698c7bfb4a2cabfc189975d06496b618b93f0845a493a8449ef7342a

Contents?: true

Size: 547 Bytes

Versions: 20

Compression:

Stored size: 547 Bytes

Contents

class RestModel
  class Property
    module Builder
      def property(name, options = {})
        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

20 entries across 20 versions & 1 rubygems

Version Path
rest_model-0.1.19 lib/rest_model/key/property/builder.rb
rest_model-0.1.18 lib/rest_model/key/property/builder.rb
rest_model-0.1.17 lib/rest_model/key/property/builder.rb
rest_model-0.1.16 lib/rest_model/key/property/builder.rb
rest_model-0.1.15 lib/rest_model/key/property/builder.rb
rest_model-0.1.14 lib/rest_model/key/property/builder.rb
rest_model-0.1.13 lib/rest_model/key/property/builder.rb
rest_model-0.1.12 lib/rest_model/key/property/builder.rb
rest_model-0.1.11 lib/rest_model/key/property/builder.rb
rest_model-0.1.10 lib/rest_model/key/property/builder.rb
rest_model-0.1.9 lib/rest_model/key/property/builder.rb
rest_model-0.1.8 lib/rest_model/key/property/builder.rb
rest_model-0.1.7 lib/rest_model/key/property/builder.rb
rest_model-0.1.6 lib/rest_model/key/property/builder.rb
rest_model-0.1.5 lib/rest_model/key/property/builder.rb
rest_model-0.1.4 lib/rest_model/key/property/builder.rb
rest_model-0.1.3 lib/rest_model/key/property/builder.rb
rest_model-0.1.2 lib/rest_model/key/property/builder.rb
rest_model-0.1.1 lib/rest_model/key/property/builder.rb
rest_model-0.1.0 lib/rest_model/key/property/builder.rb