Class: CTioga2::Graphics::Styles::CurveStyleFactory::CurveStyleFactoryParameter

Inherits:
Object
  • Object
show all
Defined in:
lib/ctioga2/graphics/styles/factory.rb

Overview

A private class that defines a parameter for the Factory

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, sets, description, short_option = nil, disable_cmds = false) ⇒ CurveStyleFactoryParameter

Creates a new CurveStyleFactoryParameter object.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# 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

Instance Attribute Details

#default_setObject

Returns a suitable default set for the given object.



44
45
46
# File 'lib/ctioga2/graphics/styles/factory.rb', line 44

def default_set
  @default_set
end

#descriptionObject

The description of the parameter.



47
48
49
# File 'lib/ctioga2/graphics/styles/factory.rb', line 47

def description
  @description
end

#disable_commandsObject

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



59
60
61
# File 'lib/ctioga2/graphics/styles/factory.rb', line 59

def disable_commands
  @disable_commands
end

#nameObject

The code-like name of the parameter



34
35
36
# File 'lib/ctioga2/graphics/styles/factory.rb', line 34

def name
  @name
end

#setsObject

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



41
42
43
# File 'lib/ctioga2/graphics/styles/factory.rb', line 41

def sets
  @sets
end

#sets_typeObject

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



55
56
57
# File 'lib/ctioga2/graphics/styles/factory.rb', line 55

def sets_type
  @sets_type
end

#short_optionObject

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



51
52
53
# File 'lib/ctioga2/graphics/styles/factory.rb', line 51

def short_option
  @short_option
end

#typeObject

The Commands::CommandType of the parameter



37
38
39
# File 'lib/ctioga2/graphics/styles/factory.rb', line 37

def type
  @type
end