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.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 60 def initialize(name, type, sets, description, short_option = nil, disable_cmds = false) @name = name @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.
44 45 46 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 44 def description @description end |
#disable_commands ⇒ Object
If this attribute is on, then CurveStyleFactory will not generate commands for this parameter, only the option.
56 57 58 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 56 def disable_commands @disable_commands end |
#name ⇒ Object
The code-like name of the parameter
34 35 36 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 34 def name @name end |
#sets ⇒ Object
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_type ⇒ Object
The MetaBuilder::Type object that can convert a String to an Array suitable for use with CircularArray.
52 53 54 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 52 def sets_type @sets_type end |
#short_option ⇒ Object
The short option for setting the parameter directly from the command-line.
48 49 50 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 48 def short_option @short_option end |
#type ⇒ Object
The Commands::CommandType of the parameter
37 38 39 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 37 def type @type end |
Instance Method Details
#default_set ⇒ Object
Returns a suitable default set for the given object.
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/ctioga2/graphics/styles/factory.rb', line 82 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 |