Class: FreshBooks::Schema::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/freshbooks/schema/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDefinition

Returns a new instance of Definition.



6
7
8
# File 'lib/freshbooks/schema/definition.rb', line 6

def initialize
  @members = ActiveSupport::OrderedHash.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *attributes) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/freshbooks/schema/definition.rb', line 10

def method_missing(method, *attributes)
  options = attributes.extract_options!
  options[:read_only] ||= false
  
  attributes.each do |attribute|
    @members[attribute.to_s] = options.merge({ :type => method.to_sym })
  end
end

Instance Attribute Details

#membersObject (readonly)

Returns the value of attribute members.



4
5
6
# File 'lib/freshbooks/schema/definition.rb', line 4

def members
  @members
end