Class: Pharrell::Environment

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

Instance Method Summary collapse

Constructor Details

#initializeEnvironment



36
37
38
39
# File 'lib/pharrell.rb', line 36

def initialize
  @configs = {}
  @config = nil
end

Instance Method Details

#config(name, opts = {}, &blk) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/pharrell.rb', line 41

def config(name, opts = {}, &blk)
  check_options([:extends], opts)

  if opts[:extends]
    @configs[name] = fetch_config(opts[:extends]).extend(blk)
  else
    @configs[name] = Config.new(blk)
  end
end

#instance_for(klass) ⇒ Object



56
57
58
# File 'lib/pharrell.rb', line 56

def instance_for(klass)
  current_config.instance_for(klass)
end

#rebuild!Object



60
61
62
# File 'lib/pharrell.rb', line 60

def rebuild!
  current_config.rebuild!
end

#use_config(name) ⇒ Object



51
52
53
54
# File 'lib/pharrell.rb', line 51

def use_config(name)
  @config = name
  rebuild!
end