Module: RidgepoleRake::Option

Extended by:
Option
Included in:
Option
Defined in:
lib/ridgepole_rake/option.rb

Instance Method Summary collapse

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

#clearObject



36
37
38
# File 'lib/ridgepole_rake/option.rb', line 36

def clear
  @stash = nil
end

#ignored_keysObject



20
21
22
# File 'lib/ridgepole_rake/option.rb', line 20

def ignored_keys
  stash.fetch('ignored_keys')
end

#non_value_key?(key) ⇒ Boolean

Returns:

  • (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_keysObject



28
29
30
# File 'lib/ridgepole_rake/option.rb', line 28

def non_value_keys
  stash.fetch('non_value_keys')
end

#recognized_keysObject



24
25
26
# File 'lib/ridgepole_rake/option.rb', line 24

def recognized_keys
  stash.fetch('recognized_keys')
end

#single_char_keysObject



32
33
34
# File 'lib/ridgepole_rake/option.rb', line 32

def single_char_keys
  stash.fetch('single_char_keys')
end