Class: MetaBuilder::ParameterTypes::StringOrRegexpParameter
- Inherits:
-
MetaBuilder::ParameterType
- Object
- MetaBuilder::ParameterType
- MetaBuilder::ParameterTypes::StringOrRegexpParameter
- Defined in:
- lib/MetaBuilder/Parameters/strings.rb
Overview
A String or a regular expression
Instance Method Summary collapse
Methods inherited from MetaBuilder::ParameterType
#default_value, from_string, get_param_type, get_type, #initialize, #lookup_const, #option_parser_long_option, #option_parser_option, #option_parser_raw, #qt4_create_input_widget, #qt4_get, #stt_run_hook, type_name, #type_to_string_internal, #type_to_variant, #variant_to_type
Constructor Details
This class inherits a constructor from MetaBuilder::ParameterType
Instance Method Details
#string_to_type(str) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/MetaBuilder/Parameters/strings.rb', line 67 def string_to_type(str) if str =~ /^\/(.*)\/$/ return Regexp.new($1) else return str end end |
#type_name ⇒ Object
63 64 65 |
# File 'lib/MetaBuilder/Parameters/strings.rb', line 63 def type_name return 'regexp' end |
#type_to_string(val) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/MetaBuilder/Parameters/strings.rb', line 75 def type_to_string(val) if val.is_a? String return val else return "/#{val}/" end end |