Class: CTioga2::MetaBuilder::Types::MarkerType

Inherits:
CTioga2::MetaBuilder::Type show all
Defined in:
lib/ctioga2/metabuilder/types/styles.rb

Overview

A marker Type for Tioga. Input as

a,(,b(,c)?)?

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



130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/ctioga2/metabuilder/types/styles.rb', line 130

def string_to_type_internal(str)
  specs = str.split(/\s*,\s*/)
  if specs.size == 2
    return [specs[0].to_i, specs[1].to_i]
  elsif specs.size == 3
    return [specs[0].to_i, specs[1].to_i, specs[2].to_f]
  elsif specs.size == 1 # Defaults to symbols !
    return [14, specs[0].to_i]
  else
    raise IncorrectInput, "You need between one and three values to make a marker"
  end
end