Module: RidgepoleRake::Option
Instance Method Summary collapse
- #add_hyphens_if_needed(key) ⇒ Object
- #clear ⇒ Object
- #ignored_keys ⇒ Object
- #non_value_key?(key) ⇒ Boolean
- #non_value_keys ⇒ Object
- #recognized_keys ⇒ Object
- #single_char_keys ⇒ Object
Instance Method Details
#add_hyphens_if_needed(key) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ridgepole_rake/option.rb', line 9 def add_hyphens_if_needed(key) case key.to_s when /\A[#{single_char_keys.join}]\z/ "-#{key}" when /\A[a-z].+\z/ "--#{key}" else key.to_s end end |
#clear ⇒ Object
36 37 38 |
# File 'lib/ridgepole_rake/option.rb', line 36 def clear @stash = nil end |
#ignored_keys ⇒ Object
20 21 22 |
# File 'lib/ridgepole_rake/option.rb', line 20 def ignored_keys stash.fetch('ignored_keys') end |
#non_value_key?(key) ⇒ Boolean
5 6 7 |
# File 'lib/ridgepole_rake/option.rb', line 5 def non_value_key?(key) non_value_keys.include?(key.to_s) end |
#non_value_keys ⇒ Object
28 29 30 |
# File 'lib/ridgepole_rake/option.rb', line 28 def non_value_keys stash.fetch('non_value_keys') end |
#recognized_keys ⇒ Object
24 25 26 |
# File 'lib/ridgepole_rake/option.rb', line 24 def recognized_keys stash.fetch('recognized_keys') end |
#single_char_keys ⇒ Object
32 33 34 |
# File 'lib/ridgepole_rake/option.rb', line 32 def single_char_keys stash.fetch('single_char_keys') end |