Class: CTioga2::Graphics::Styles::CurveStyleFactory::CurveStyleFactoryParameter
- Inherits:
-
Object
- Object
- CTioga2::Graphics::Styles::CurveStyleFactory::CurveStyleFactoryParameter
- Defined in:
- lib/ctioga2/graphics/styles/factory.rb
Overview
A private class that defines a parameter for the Factory
Instance Attribute Summary collapse
-
#description ⇒ Object
The description of the parameter.
-
#disable_commands ⇒ Object
If this attribute is on, then CurveStyleFactory will not generate commands for this parameter, only the option.
-
#name ⇒ Object
The code-like name of the parameter.
-
#sets ⇒ Object
The pre-defined sets available to use with that parameter.
-
#sets_type ⇒ Object
The MetaBuilder::Type object that can convert a String to an Array suitable for use with CircularArray.
-
#short_option ⇒ Object
The short option for setting the parameter directly from the command-line.
-
#type ⇒ Object
The Commands::CommandType of the parameter.
Instance Method Summary collapse
-
#default_set ⇒ Object
Returns a suitable default set for the given object.
-
#initialize(name, type, sets, description, short_option = nil, disable_cmds = false) ⇒ CurveStyleFactoryParameter
constructor
Creates a new CurveStyleFactoryParameter object.
Constructor Details
#initialize(name, type, sets, description, short_option = nil, disable_cmds = false) ⇒ CurveStyleFactoryParameter
Creates a new CurveStyleFactoryParameter object.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 62 def initialize(name, type, sets, description, short_option = nil, disable_cmds = false) @name = name @type = Commands::CommandType.get_type(type) @sets = sets @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
#description ⇒ Object
The description of the parameter.
46 47 48 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 46 def description @description end |
#disable_commands ⇒ Object
If this attribute is on, then CurveStyleFactory will not generate commands for this parameter, only the option.
58 59 60 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 58 def disable_commands @disable_commands end |
#name ⇒ Object
The code-like name of the parameter
36 37 38 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 36 def name @name end |
#sets ⇒ Object
The pre-defined sets available to use with that parameter. It is a hash.
43 44 45 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 43 def sets @sets end |
#sets_type ⇒ Object
The MetaBuilder::Type object that can convert a String to an Array suitable for use with CircularArray.
54 55 56 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 54 def sets_type @sets_type end |
#short_option ⇒ Object
The short option for setting the parameter directly from the command-line.
50 51 52 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 50 def short_option @short_option end |
#type ⇒ Object
The Commands::CommandType of the parameter
39 40 41 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 39 def type @type end |
Instance Method Details
#default_set ⇒ Object
Returns a suitable default set for the given object.
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 84 def default_set return nil unless @sets if @sets.key? 'default' return @sets['default'] else @sets.each do |k,v| return v end end end |