class CTioga2::MetaBuilder::Types::REListParameter
A choice between different symbols based on regular expressions.
Public Class Methods
new(type)
click to toggle source
Calls superclass method
CTioga2::MetaBuilder::Type::new
# File lib/ctioga2/metabuilder/types/lists.rb, line 113 def initialize(type) super raise "type must have a :list key" unless type.has_key?(:list) # We make a copy for our own purposes. @re_hash = type[:list].dup end
Public Instance Methods
string_to_type_internal(str)
click to toggle source
# File lib/ctioga2/metabuilder/types/lists.rb, line 124 def string_to_type_internal(str) for k,v in @re_hash if str =~ /^\s*#{k}\s*$/ return v end end raise IncorrectInput, "Invalid input: '#{str}' should match " + @re_hash.keys.map {|s| s.to_s}.join(',') end
type_name()
click to toggle source
# File lib/ctioga2/metabuilder/types/lists.rb, line 120 def type_name return 'relist' end
type_to_string_internal(val)
click to toggle source
# File lib/ctioga2/metabuilder/types/lists.rb, line 134 def type_to_string_internal(val) return val.to_s end