Module: Xqsr3::CommandLineUtilities::MapOptionString

Included in:
String
Defined in:
lib/xqsr3/command_line_utilities/map_option_string.rb

Overview

Facilities for mapping strings to options

Components of interest

  • ::Xqsr3::CommandLineUtilities::MapOptionString.map_option_string

Defined Under Namespace

Modules: MapOptionString_Helper_

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(includer) ⇒ Object

:nodoc:

Raises:

  • (TypeError)


64
65
66
67
# File 'lib/xqsr3/command_line_utilities/map_option_string.rb', line 64

def self.included includer

	raise TypeError, "module #{self} cannot be included into #{includer} because it does not respond to to_str" unless includer.method_defined? :to_str
end

.map_option_string_from_string(s, option_strings, options = {}) ⇒ Object

Attempts to translate the value of a given string according to a collection of options strings



118
119
120
121
# File 'lib/xqsr3/command_line_utilities/map_option_string.rb', line 118

def self.map_option_string_from_string s, option_strings, options = {}

	MapOptionString_Helper_.map_option_string_with_options_ s, option_strings, options
end

Instance Method Details

#map_option_string(option_strings, options = {}) ⇒ Object

Attempts to translate the (string) value of the receiver according to a collection of options strings



125
126
127
128
129
130
# File 'lib/xqsr3/command_line_utilities/map_option_string.rb', line 125

def map_option_string option_strings, options = {}

	s = self.kind_of?(::String) ? self : self.to_str

	MapOptionString_Helper_.map_option_string_with_options_ s, option_strings, options
end