Class: Configuration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



14
15
16
17
18
19
20
# File 'lib/configuration.rb', line 14

def initialize
  @log_file = $stderr
  @app_base = '/srv'

  @logger = Logger.new(log_file)
  @runner = Runner.new(logger)
end

Instance Attribute Details

#app_baseObject

Returns the value of attribute app_base.



23
24
25
# File 'lib/configuration.rb', line 23

def app_base
  @app_base
end

#log_fileObject

Returns the value of attribute log_file.



22
23
24
# File 'lib/configuration.rb', line 22

def log_file
  @log_file
end

#loggerObject (readonly)

Returns the value of attribute logger.



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

def logger
  @logger
end

#runnerObject

Returns the value of attribute runner.



24
25
26
# File 'lib/configuration.rb', line 24

def runner
  @runner
end

Class Method Details

.currentObject



7
# File 'lib/configuration.rb', line 7

def current; @current ||= new; end

.method_missing(sym, *args, &block) ⇒ Object



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

def method_missing(sym, *args, &block)
  return current.send(sym, *args, &block) if current.respond_to?(sym)
  super
end

.resetObject



6
# File 'lib/configuration.rb', line 6

def reset; @current = nil; end

Instance Method Details

#app_base_path(*args) ⇒ Object



32
33
34
# File 'lib/configuration.rb', line 32

def app_base_path *args
  Pathname.new File.join(@app_base, *args)
end