Class: Ober::Configuration

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

Overview

Ober configuration, which is read from a file called ‘ober_menu’ or from stdin. The configuration is a Ruby DSL. Check out child classes of the configuration for understanding the DSL.

Defined Under Namespace

Classes: Application, Environment, Source

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



71
72
73
# File 'lib/ober/configuration.rb', line 71

def initialize
  @environments = Hash.new { |h,k| h[k] = Environment.new(k) }
end

Class Method Details

.parse(*args) ⇒ Object



63
64
65
# File 'lib/ober/configuration.rb', line 63

def self.parse *args
  new.tap { |o| o.parse(*args) }
end

Instance Method Details

#environment(env) ⇒ Object



75
76
77
# File 'lib/ober/configuration.rb', line 75

def environment env
  @environments[env.to_sym]
end

#parse(source, file_name) ⇒ Object



66
67
68
69
# File 'lib/ober/configuration.rb', line 66

def parse source, file_name
  context = Source.new(self)
  context.instance_eval { binding.eval(source, file_name) }
end