Method: JSONAPI::Consumer::Schema#add

Defined in:
lib/jsonapi/consumer/schema.rb

#add(name, options) ⇒ void

This method returns an undefined value.

Add a property to the schema

Parameters:

  • name (Symbol)

    the name of the property

  • options (Hash)

    property options

Options Hash (options):

  • :type (Symbol)

    The property type

  • :default (Symbol)

    The default value for the property



118
119
120
# File 'lib/jsonapi/consumer/schema.rb', line 118

def add(name, options)
  @properties[name.to_sym] = Property.new(name.to_sym, options[:type], options[:default])
end