Module: RidgepoleRake::Option

Defined in:
lib/ridgepole_rake/option.rb

Constant Summary collapse

SUPPORTED_VERSIONS =
{
  '0.5.0' => OptionKeys::V050,
  '0.5.1' => OptionKeys::V051,
  '0.5.2' => OptionKeys::V052,
  '0.6.0' => OptionKeys::V060,
  '0.6.1' => OptionKeys::V061,
  '0.6.2' => OptionKeys::V062,
  '0.6.3' => OptionKeys::V063,
  '0.6.4' => OptionKeys::V064,
  '0.6.5' => OptionKeys::V065,
}.freeze

Class Method Summary collapse

Class Method Details

.add_hyphens_if_needed(key) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/ridgepole_rake/option.rb', line 22

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



49
50
51
# File 'lib/ridgepole_rake/option.rb', line 49

def clear
  @stash = nil
end

.ignored_keysObject



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

def ignored_keys
  stash.fetch(:ignored_keys)
end

.non_value_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/ridgepole_rake/option.rb', line 18

def non_value_key?(key)
  non_value_keys.include?(key.to_s)
end

.non_value_keysObject



41
42
43
# File 'lib/ridgepole_rake/option.rb', line 41

def non_value_keys
  stash.fetch(:non_value_keys)
end

.recognized_keysObject



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

def recognized_keys
  stash.fetch(:recognized_keys)
end

.single_char_keysObject



45
46
47
# File 'lib/ridgepole_rake/option.rb', line 45

def single_char_keys
  stash.fetch(:single_char_keys)
end