module RidgepoleRake::Option

Constants

SUPPORTED_VERSIONS

Public Class Methods

add_hyphens_if_needed(key) click to toggle source
# 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
clear() click to toggle source
# File lib/ridgepole_rake/option.rb, line 49
def clear
  @stash = nil
end
ignored_keys() click to toggle source
# File lib/ridgepole_rake/option.rb, line 33
def ignored_keys
  stash.fetch(:ignored_keys)
end
non_value_key?(key) click to toggle source
# File lib/ridgepole_rake/option.rb, line 18
def non_value_key?(key)
  non_value_keys.include?(key.to_s)
end
non_value_keys() click to toggle source
# File lib/ridgepole_rake/option.rb, line 41
def non_value_keys
  stash.fetch(:non_value_keys)
end
recognized_keys() click to toggle source
# File lib/ridgepole_rake/option.rb, line 37
def recognized_keys
  stash.fetch(:recognized_keys)
end
single_char_keys() click to toggle source
# File lib/ridgepole_rake/option.rb, line 45
def single_char_keys
  stash.fetch(:single_char_keys)
end

Private Class Methods

current_version_class() click to toggle source
# File lib/ridgepole_rake/option.rb, line 64
def current_version_class
  SUPPORTED_VERSIONS.fetch(ridgepole_version)
end
ridgepole_version() click to toggle source
# File lib/ridgepole_rake/option.rb, line 68
def ridgepole_version
  Ridgepole::VERSION
end
stash() click to toggle source
# File lib/ridgepole_rake/option.rb, line 55
def stash
  @stash ||= {
    ignored_keys:     current_version_class::IGNORED_KEYS,
    recognized_keys:  current_version_class::RECOGNIZED_KEYS,
    non_value_keys:   current_version_class::NON_VALUE_KEYS,
    single_char_keys: current_version_class::SINGLE_CHAR_KEYS
  }
end