Class: Duffel

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

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.method_missing(method, *args, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/duffel.rb', line 6

def method_missing(method, *args, &block)
  define_singleton_method(method) do |options={}|
    options ||= {}
    return_value = options.fetch(:fallback, fetch_default)
    fallback = format_return_value(return_value)

    env_name = method.to_s.upcase
    ENV.fetch(env_name, &fallback)
  end
  self.send(method, args.first)
end