class Soryo::Command
Attributes
config[R]
Public Class Methods
add_command(program)
click to toggle source
# File lib/commands/command.rb, line 38 def self.add_command(program) abort('Command.self.add_command should not be called on their own') end
add_options(c)
click to toggle source
# File lib/commands/command.rb, line 34 def self.add_options(c) c.option 'config_file', '--config', 'choose a different config file' end
descendants()
click to toggle source
# File lib/commands/command.rb, line 9 def self.descendants descendants = [] ObjectSpace.each_object(singleton_class) do |k| descendants.unshift k unless k == self end descendants end
new(options)
click to toggle source
# File lib/commands/command.rb, line 17 def initialize(options) @config = Soryo::Config.new unless options.nil? @config.merge_with(options) end get_settings_file end
Public Instance Methods
get_settings_file()
click to toggle source
# File lib/commands/command.rb, line 26 def get_settings_file if @config[:settings_file] @config.read_yaml(@config[:settings_file]) elsif Pathname.new('settings.yaml').exist? @config.read_yaml('settings.yaml') end end