Class: Cucumba::Drb::Server

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

Instance Method Summary collapse

Instance Method Details

#execute(code) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/cucumba/drb.rb', line 23

def execute(code)
	logger.info "Evaluating code (for TODO_IP at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}) [DRb]"
	logger.info '---'
	logger.info code
	logger.info '---'
  Object.send :eval, code
rescue Exception => e
	handle_exception(e)
	raise RuntimeError, e.message
end

#has_model?(model) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/cucumba/drb.rb', line 7

def has_model?(model)
  Object.const_defined?(model.to_s.classify)
end

#invoke_method_on_model(model, method, *args) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/cucumba/drb.rb', line 15

def invoke_method_on_model(model,method,*args)
	logger.info "Processing #{model}.#{method.to_s} (for TODO_IP at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}) [DRb]"
	Object.const_get(model).method(method).call(*args.first)
rescue Exception => e
	handle_exception(e)
	raise RuntimeError, "#{e.class.to_s} #{e.message}"
end

#model_has_method?(model, method) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/cucumba/drb.rb', line 11

def model_has_method?(model,method)
  Object.const_get(model).respond_to?(method)
end