Module: Envie

Defined in:
lib/envie.rb,
lib/envie/env.rb,
lib/envie/featurable.rb

Defined Under Namespace

Modules: Featurable Classes: Env

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.currentObject (readonly)

Returns the value of attribute current.



6
7
8
# File 'lib/envie.rb', line 6

def current
  @current
end

Class Method Details

.allObject



8
9
10
# File 'lib/envie.rb', line 8

def all
  @envs ||= {}
end

.at(name) ⇒ Object



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

def at(name)
  all[name] ||= Env.new
end

.has?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

def has?(name)
  @current.has?(name)
end

.method_missing(name) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/envie.rb', line 12

def method_missing(name)
  if name =~ /^(.*)\?$/
    feature = $1.to_sym
    has?(feature)
  else
    at(name)
  end
end

.use(name) ⇒ Object



29
30
31
# File 'lib/envie.rb', line 29

def use(name)
  @current = at(name)
end