Class: CTioga2::MetaBuilder::Types::LineStyleType

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

Overview

A line style for Tioga. It will be represented as:

a,b,c,d,...:e

This creates a line style of:

[[a,b,c,d,...],e]

If the :e is omitted 0 is used.

Instance Attribute Summary

Attributes inherited from CTioga2::MetaBuilder::Type

#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



81
82
83
84
85
86
87
88
89
90
# File 'lib/ctioga2/metabuilder/types/styles.rb', line 81

def string_to_type_internal(str)
  specs = str.split(/\s*,\s*/)
  if specs.last =~ /:(.*)$/
    phase = $1.to_f
    specs.last.gsub!(/:.*$/,'')
  else
    phase = 0
  end
  return [ specs.map { |s| s.to_f }, phase]
end