Module: FutureWrapper

Defined in:
lib/moki_ruby/future_wrapper.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



11
12
13
14
15
16
17
18
# File 'lib/moki_ruby/future_wrapper.rb', line 11

def method_missing(sym, *args, &block)
  response = value
  if response.respond_to? sym
    response.send sym, *args, &block
  else
    response.body.send sym, *args, &block
  end
end

Instance Method Details

#[](key) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/moki_ruby/future_wrapper.rb', line 2

def[](key)
  response = value
  if response[key].present?
    response[key]
  else
    response.body[key]
  end
end