class Ru::OptionPrinter

Public Instance Methods

exists?(option_key) click to toggle source
# File lib/ru/option_printer.rb, line 5
def exists?(option_key)
  options[option_key].present?
end
run(option_key, option_value=nil) click to toggle source
# File lib/ru/option_printer.rb, line 9
def run(option_key, option_value=nil)
  send(options[option_key], *option_value)
end

Private Instance Methods

get_help() click to toggle source
# File lib/ru/option_printer.rb, line 22
def get_help
  namespace = OpenStruct.new(version: Ru::VERSION)
  template_path = ::File.expand_path("../../../doc/help.erb", __FILE__)
  template = ::File.open(template_path).read
  ERB.new(template).result(namespace.instance_eval { binding })
end
get_version() click to toggle source
# File lib/ru/option_printer.rb, line 29
def get_version
  Ru::VERSION
end
options() click to toggle source
# File lib/ru/option_printer.rb, line 15
def options
  {
    help: :get_help,
    version: :get_version
  }
end