Class: Coconut::Dsl::Environment

Inherits:
BlankSlate show all
Defined in:
lib/coconut/dsl/environment.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BlankSlate

__forbidden_names

Constructor Details

#initializeEnvironment

Returns a new instance of Environment.



11
12
13
# File 'lib/coconut/dsl/environment.rb', line 11

def initialize
  @properties = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)



22
23
24
25
# File 'lib/coconut/dsl/environment.rb', line 22

def method_missing(name, *args, &block)
  ::Kernel::raise InvalidName, "#{name} can't be used as property name" if _taken?(name)
  @properties[name] = args.first
end

Class Method Details

.configure(&config) ⇒ Object



7
8
9
# File 'lib/coconut/dsl/environment.rb', line 7

def self.configure(&config)
  new.configure(&config)
end

Instance Method Details

#configure(&config) ⇒ Object



15
16
17
18
# File 'lib/coconut/dsl/environment.rb', line 15

def configure(&config)
  instance_eval &config
  @properties
end