Class: Retter::Config

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/retter/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Config

Returns a new instance of Config.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/retter/config.rb', line 18

def initialize(env)
  @env             = env
  @after_callbacks = {}
  @attributes      = {}

  detect_retter_home
  environments_required

  @retter_home = Pathname.new(@env['RETTER_HOME'])
  load_defaults
  load_retterfile_if_exists
rescue EnvError => e
  $stderr.puts e.message

  say Command.usage, :green

  exit 1
end

Instance Attribute Details

#retter_homeObject (readonly)

Returns the value of attribute retter_home.



16
17
18
# File 'lib/retter/config.rb', line 16

def retter_home
  @retter_home
end

Instance Method Details

#after_callback(name, sym = nil, &block) ⇒ Object Also known as: after



37
38
39
40
41
42
43
# File 'lib/retter/config.rb', line 37

def after_callback(name, sym = nil, &block)
  if callback = sym || block
    @after_callbacks[name] = callback
  else
    @after_callbacks[name]
  end
end