Class: OptimistXL::BooleanOption

Inherits:
Option
  • Object
show all
Defined in:
lib/optimist_xl.rb

Overview

Flag option. Has no arguments. Can be negated with “no-”.

Instance Attribute Summary

Attributes inherited from Option

#default, #long, #max_args, #min_args, #multi_given, #name, #permitted, #permitted_response, #short

Instance Method Summary collapse

Methods inherited from Option

#array_default?, #callback, #compatible_with?, create, #desc, #description_with_default, #description_with_permitted, #doesnt_need_autogen_short, #educate, #format_stdio, #full_description, handle_long_opt, handle_short_opt, #multi, #opts, #opts=, #permitted_type_valid?, #permitted_valid_string, #permitted_value?, register_alias, #required?, #type_format, #validate_permitted

Constructor Details

#initializeBooleanOption

Returns a new instance of BooleanOption.



1134
1135
1136
1137
1138
1139
# File 'lib/optimist_xl.rb', line 1134

def initialize
  super()
  @default = false
  @min_args = 0
  @max_args = 0
end

Instance Method Details

#parse(_paramlist, neg_given) ⇒ Object



1141
1142
1143
# File 'lib/optimist_xl.rb', line 1141

def parse(_paramlist, neg_given)
  return(self.name.to_s =~ /^no_/ ? neg_given : !neg_given)
end