Class: CTioga2::MetaBuilder::Types::PartialFloatRangeType
- Inherits:
-
CTioga2::MetaBuilder::Type
- Object
- CTioga2::MetaBuilder::Type
- CTioga2::MetaBuilder::Types::PartialFloatRangeType
- Defined in:
- lib/ctioga2/metabuilder/types/numbers.rb
Overview
Returns a [ start, end ] array where elements are either Float or nil.
Constant Summary collapse
- RANGE_RE =
/([^:]+)?:([^:]+)?/
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
#boolean?, #default_value, from_string, get_param_type, get_type, #initialize, #option_parser_long_option, #option_parser_option, #string_to_type, #type_name, type_name, #type_to_string
Constructor Details
This class inherits a constructor from CTioga2::MetaBuilder::Type
Instance Method Details
#string_to_type_internal(str) ⇒ Object
79 80 81 82 83 84 |
# File 'lib/ctioga2/metabuilder/types/numbers.rb', line 79 def string_to_type_internal(str) raise IncorrectInput, "'#{str}' is not a valid range" unless str =~ RANGE_RE s,e = ($1 ? Float($1) : nil), ($2 ? Float($2) : nil) return [s, e] end |
#type_to_string_internal(value) ⇒ Object
86 87 88 |
# File 'lib/ctioga2/metabuilder/types/numbers.rb', line 86 def type_to_string_internal(value) return "#{value.first.to_s}:#{value.last.to_s}" end |