Class: MetaBuilder::ParameterTypes::BooleanParameter

Inherits:
MetaBuilder::ParameterType show all
Defined in:
lib/MetaBuilder/Parameters/lists.rb

Overview

A boolean parameter

Instance Method Summary collapse

Methods inherited from MetaBuilder::ParameterType

#default_value, from_string, get_param_type, get_type, #initialize, #lookup_const, #option_parser_option, #option_parser_raw, #qt4_create_input_widget, #qt4_get, #string_to_type, #stt_run_hook, type_name, #type_to_string, #type_to_variant, #variant_to_type

Constructor Details

This class inherits a constructor from MetaBuilder::ParameterType

Instance Method Details

#option_parser_long_option(name) ⇒ Object

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



60
61
62
# File 'lib/MetaBuilder/Parameters/lists.rb', line 60

def option_parser_long_option(name)
  return "--[no-]#{name}"
end

#string_to_type_internal(str) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/MetaBuilder/Parameters/lists.rb', line 42

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

#type_nameObject



38
39
40
# File 'lib/MetaBuilder/Parameters/lists.rb', line 38

def type_name
  return 'bool'
end

#type_to_string_internal(val) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/MetaBuilder/Parameters/lists.rb', line 50

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