Class: Utusemi::Definition

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

Constant Summary collapse

UNPROXIED_METHODS =
%w(__send__ __id__ nil? send object_id extend instance_eval initialize block_given? raise caller method instance_exec)
OPTION_METHODS =
%w(class_name foreign_key)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Definition

Returns a new instance of Definition.



16
17
18
19
# File 'lib/utusemi/definition.rb', line 16

def initialize(options = {})
  @attributes = {}
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



26
27
28
# File 'lib/utusemi/definition.rb', line 26

def method_missing(name, *args)
  add_attribute(name, *args)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



14
15
16
# File 'lib/utusemi/definition.rb', line 14

def attributes
  @attributes
end

Instance Method Details

#exec(*args, &block) ⇒ Object



21
22
23
24
# File 'lib/utusemi/definition.rb', line 21

def exec(*args, &block)
  instance_exec(*args, &block) if block_given?
  self
end