class DTK::Client::CLI::Command::Options
Attributes
opts_hash[R]
Public Class Methods
new(opts_hash)
click to toggle source
# File lib/cli/command/options.rb, line 24 def initialize(opts_hash) @opts_hash = opts_hash end
Public Instance Methods
[](canonical_name_or_opt)
click to toggle source
# File lib/cli/command/options.rb, line 28 def [](canonical_name_or_opt) key = Token.opt?(canonical_name_or_opt) || canonical_name_or_opt # TODO: check why this switch to below was needed was needed #@opts_hash[key] case key when ::String, ::Symbol @opts_hash[key] when ::Array if matching_key = key.find { |k| @opts_hash.has_key?(k) } @opts_hash[matching_key] end else raise Eroor, "Unexpected value of key.class: #{key.class}" end end