Class: Ubiquitous::BaseModel

Inherits:
Object
  • Object
show all
Defined in:
lib/ubiquitous/base_model.rb

Instance Method Summary collapse

Constructor Details

#initialize(session, index = 0, model) ⇒ BaseModel

Returns a new instance of BaseModel.



6
7
8
9
10
11
# File 'lib/ubiquitous/base_model.rb', line 6

def initialize(session, index=0, model)
  @session = session
  @normalised_model_name = model.class.name.downcase
  @model = model
  @index = index
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



13
14
15
16
17
# File 'lib/ubiquitous/base_model.rb', line 13

def method_missing(method_name, *args, &block)
  @method_name = method_name
  assert_presence_of_method_on_model(@method_name)
  @session.find(:id, element_namespace)
end