Class: Chaindrive::Command::Config

Inherits:
Thor
  • Object
show all
Defined in:
lib/chaindrive/command/config.rb

Overview

Public - Manages the application configuration and runtime options.

Instance Method Summary collapse

Instance Method Details

#get(name) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/chaindrive/command/config.rb', line 26

def get(name)
  env = Chaindrive::Environment.new(options)
  if Chaindrive::Config.method_defined?(name.to_sym)
    puts env.config[name.to_sym] if env.config.send(name.to_sym)
  else
    Chaindrive.logger.warn "Configuration does not contain '#{name}' property."
  end
end

#set(name, value) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/chaindrive/command/config.rb', line 15

def set(name, value)
  env = Chaindrive::Environment.new(options)
  if Chaindrive::Config.method_defined?(name.to_sym)
    env.config[name.to_sym] = value
    env.config.save!
  else
    Chaindrive.logger.warn "Configuration can not set '#{name}' property."
  end
end