Class: Holoserve::Response::Selector
- Inherits:
-
Object
- Object
- Holoserve::Response::Selector
- Defined in:
- lib/holoserve/response/selector.rb
Defined Under Namespace
Classes: Sandbox
Instance Method Summary collapse
-
#initialize(responses, state, logger) ⇒ Selector
constructor
A new instance of Selector.
- #selection ⇒ Object
Constructor Details
Instance Method Details
#selection ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/holoserve/response/selector.rb', line 27 def selection @responses.each do |key, response| next if key.to_sym == :default || !response.has_key?(:condition) begin match = @sandbox.instance_eval do eval response[:condition] end return key.to_sym if match rescue Object => error @logger.error "error evaluating condition: [#{response[:condition]}] #{error.inspect}" end end @responses.has_key?(:default) ? :default : nil end |