Module: Ecolo::EnvWith

Defined in:
lib/ecolo.rb

Constant Summary collapse

ACCESSOR =
[:env, :env=].freeze
DELEGATE =
-> { ACCESSOR.each { |a| def_instance_delegator :@ecolo, a }; self }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



15
16
17
18
# File 'lib/ecolo.rb', line 15

def self.extended(base)
  singleton_base = base.singleton_class.extend Forwardable
  singleton_base.class_exec &DELEGATE
end

.included(base) ⇒ Object



20
21
22
23
# File 'lib/ecolo.rb', line 20

def self.included(base)
  base.include(Forwardable).send :module_function, :def_instance_delegator
  base.class_exec(&DELEGATE).send :module_function, *ACCESSOR, :env_with
end

Instance Method Details

#env_with(options = self) ⇒ Object



25
26
27
# File 'lib/ecolo.rb', line 25

def env_with(options=self)
  @ecolo = Delegator.with options
end