class Af::OptionParser::OptionType
Attributes
argument_note[R]
evaluate_method[R]
handler_method[R]
name[R]
short_name[R]
Public Class Methods
find_by_short_name(short_name)
click to toggle source
# File lib/fiksu-af/option_parser/option_type.rb, line 36 def self.find_by_short_name(short_name) return types.find{ |t| t.short_name == short_name } end
find_by_value(value)
click to toggle source
# File lib/fiksu-af/option_parser/option_type.rb, line 32 def self.find_by_value(value) return types.find{ |t| t.handle?(value) } end
new(name, short_name, argument_note, evaluate_method, handler_method)
click to toggle source
# File lib/fiksu-af/option_parser/option_type.rb, line 11 def initialize(name, short_name, argument_note, evaluate_method, handler_method) @name = name @short_name = short_name @argument_note = argument_note @evaluate_method = evaluate_method @handler_method = handler_method @@types << self end
types()
click to toggle source
++++++++++++++++++++
# File lib/fiksu-af/option_parser/option_type.rb, line 24 def self.types return @@types end
valid_option_type_names()
click to toggle source
# File lib/fiksu-af/option_parser/option_type.rb, line 28 def self.valid_option_type_names return types.map(&:short_name) end
Public Instance Methods
evaluate_argument(argument, option)
click to toggle source
+++++++++++++++++++++++
# File lib/fiksu-af/option_parser/option_type.rb, line 44 def evaluate_argument(argument, option) if @evaluate_method.is_a? Symbol return argument.send(@evaluate_method) end return @evaluate_method.call(argument, option) end
handle?(value)
click to toggle source
# File lib/fiksu-af/option_parser/option_type.rb, line 51 def handle?(value) if @handler_method.is_a? Class return value.is_a? @handler_method end return @handler_method.call(value) end