Class: Holoserve::Response::Selector::Sandbox

Inherits:
Object
  • Object
show all
Defined in:
lib/holoserve/response/selector.rb

Instance Method Summary collapse

Constructor Details

#initialize(state, logger) ⇒ Sandbox

Returns a new instance of Sandbox.



6
7
8
9
10
11
12
13
# File 'lib/holoserve/response/selector.rb', line 6

def initialize(state, logger)
  @logger = logger
  state.each do |resource, value|
    define_singleton_method resource.to_sym do
      value ? value.to_sym : nil
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



15
16
17
18
# File 'lib/holoserve/response/selector.rb', line 15

def method_missing(method_name, *arguments, &block)
  @logger.warn "tried to use undefined state key '#{method_name}'"
  nil
end