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

#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)


49
50
51
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 49

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



71
72
73
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 71

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

#string_to_type_internal(str) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 53

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

#type_nameObject



44
45
46
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 44

def type_name
  return 'bool'
end

#type_to_string_internal(val) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/ctioga2/metabuilder/types/lists.rb', line 61

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