Class: Cucumba::Rails::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumba/rails/model.rb

Defined Under Namespace

Classes: NotFoundError

Instance Method Summary collapse

Constructor Details

#initialize(model_name, server) ⇒ Model

Returns a new instance of Model.



8
9
10
11
12
13
14
15
# File 'lib/cucumba/rails/model.rb', line 8

def initialize(model_name,server)
	@server = server
	if @server.has_model?(model_name)
	  @model = model_name
	else
	  raise NotFoundError
	end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/cucumba/rails/model.rb', line 17

def method_missing(method,*args)
  if @server.model_has_method?(@model,method)
	  @server.invoke_method_on_model(@model,method,args)
	else
	  super
	end
end