class CTioga2::MetaBuilder::Types::FunctionBasedType
A type based on a conversion function from_text from a given class/module.
Public Class Methods
new(type)
click to toggle source
Calls superclass method
CTioga2::MetaBuilder::Type::new
# File lib/ctioga2/metabuilder/types/generic.rb, line 38 def initialize(type) super raise "type must have a :class key" unless type.has_key?(:class) # We make a copy for our own purposes. @cls = type[:class] @func_name = type[:func_name] || :from_text end
Public Instance Methods
string_to_type_internal(str)
click to toggle source
# File lib/ctioga2/metabuilder/types/generic.rb, line 46 def string_to_type_internal(str) return @cls.send(@func_name, str) end
type_name()
click to toggle source
# File lib/ctioga2/metabuilder/types/generic.rb, line 33 def type_name return 'function_based' end
type_to_string_internal(val)
click to toggle source
# File lib/ctioga2/metabuilder/types/generic.rb, line 50 def type_to_string_internal(val) return val.to_s end