Module: GemRelease::CommandOptions
- Defined in:
- lib/gem_release/command_options.rb
Instance Method Summary collapse
- #default_options_with(passed_opts) ⇒ Object
- #initialize(*args) ⇒ Object
- #option(key, short, description) ⇒ Object
Instance Method Details
#default_options_with(passed_opts) ⇒ Object
8 9 10 |
# File 'lib/gem_release/command_options.rb', line 8 def (passed_opts) self.class::DEFAULTS.merge(Configuration.new[name.to_sym]).merge(passed_opts) end |
#initialize(*args) ⇒ Object
3 4 5 6 |
# File 'lib/gem_release/command_options.rb', line 3 def initialize(*args) @arguments = '' super end |
#option(key, short, description) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gem_release/command_options.rb', line 12 def option(key, short, description) default = Configuration.new[name.to_sym][key] || self.class::DEFAULTS[key] if default.is_a?(String) long = "--#{key} #{key.to_s.upcase}" if default == '' default_description = 'not set by default' else default_description = "defaults to #{default}" end args = [short, long, String, "#{description} (#{default_description})"] else long = "--[no-]#{key}" args = [short, long, "#{description} (defaults to #{default})"] end add_option(*args) { |value, | [key] = value } end |