class CTioga2::Graphics::Styles::CurveStyleFactory::CurveStyleFactoryParameter

A private class that defines a parameter for the Factory

Attributes

default_set[RW]

The name of the default set, when it isn't 'default'

description[RW]

The description of the parameter.

disable_commands[RW]

If this attribute is on, then CurveStyleFactory will not generate commands for this parameter, only the option.

name[RW]

The code-like name of the parameter

sets[RW]

The pre-defined sets available to use with that parameter. It is a hash.

sets_type[RW]

The MetaBuilder::Type object that can convert a String to an Array suitable for use with CircularArray.

short_option[RW]

The short option for setting the parameter directly from the command-line.

type[RW]

The Commands::CommandType of the parameter

Public Class Methods

new(name, type, sets, description, short_option = nil, disable_cmds = false) click to toggle source

Creates a new CurveStyleFactoryParameter object.

# File lib/ctioga2/graphics/styles/factory.rb, line 63
def initialize(name, type, sets, description, 
               short_option = nil, disable_cmds = false)
  @name = name
  @type = type
  if sets
    # If the sets is an array, it is of the form [sets, 'default set']
    if sets.is_a? Array
      @sets = sets[0]
      @default_set = sets[1]
    else
      @sets = sets
    end
  end
  @description = description
  @short_option = short_option
  @disable_commands = disable_cmds
  
  ## \todo it is not very satisfying to mix CommandTypes and
  # MetaBuilder::Type on the same level.
  if @sets
    @sets_type = 
      MetaBuilder::Type.get_type({
                                   :type => :set,
                                   :subtype => @type.type,
                                   :shortcuts => @sets
                                 })
  end
end