Class: CTioga2::MetaBuilder::Types::BooleanParameter

Inherits:
CTioga2::MetaBuilder::Type show all
Defined in:
lib/ctioga2/metabuilder/types/lists.rb

Overview

A boolean parameter

Instance Attribute Summary

Attributes inherited from CTioga2::MetaBuilder::Type

#namespace, #namespace_lookup, #passthrough, #re_shortcuts, #shortcuts, #type

Instance Method Summary collapse

Methods inherited from CTioga2::MetaBuilder::Type

#default_value, from_string, get_param_type, get_type, #initialize, #option_parser_option, #string_to_type, type_name, #type_to_string

Constructor Details

This class inherits a constructor from CTioga2::MetaBuilder::Type

Instance Method Details

#boolean?Boolean

Yes, this really is a boolean !

Returns:

  • (Boolean)


46
47
48
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 46

def boolean?
  return true
end

#option_parser_long_option(name, biniou = nil) ⇒ Object

Booleans are a special case for option parser, as they are handled completely differently



68
69
70
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 68

def option_parser_long_option(name, biniou = nil)
  return "--[no-]#{name}"
end

#string_to_type_internal(str) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 50

def string_to_type_internal(str)
  if str == true or str =~ TRUE_RE
    return true
  else
    return false
  end
end

#type_nameObject



41
42
43
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 41

def type_name
  return 'bool'
end

#type_to_string_internal(val) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 58

def type_to_string_internal(val)
  if val
    return "true"
  else
    return "false"
  end
end