Class: Tabry::CLI::Util::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/tabry/cli/util/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



32
33
34
# File 'lib/tabry/cli/util/config.rb', line 32

def initialize(path)
  @path = path.gsub(/^~/, Dir.home)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



40
41
42
# File 'lib/tabry/cli/util/config.rb', line 40

def method_missing(*args)
  config.send(*args)
end

Instance Method Details

#configObject



36
37
38
# File 'lib/tabry/cli/util/config.rb', line 36

def config
  @config ||= YAML.load_file(@path).to_openstruct
end

#respond_to_missing?(*args) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/tabry/cli/util/config.rb', line 44

def respond_to_missing?(*args)
  super?(*args) || config.respond_to_missing?(*args)
end