Class: ConfigTable::Item
- Inherits:
-
Object
- Object
- ConfigTable::Item
- Defined in:
- lib/priority-queue/setup.rb
Direct Known Subclasses
BoolItem, ExecItem, PackageSelectionItem, PathItem, ProgramItem, SelectItem
Instance Attribute Summary collapse
-
#default ⇒ Object
(also: #help_default)
Returns the value of attribute default.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #help_opt ⇒ Object
-
#initialize(name, template, default, desc) ⇒ Item
constructor
A new instance of Item.
- #resolve(table) ⇒ Object
- #set(val) ⇒ Object
- #value ⇒ Object
- #value? ⇒ Boolean
Constructor Details
#initialize(name, template, default, desc) ⇒ Item
Returns a new instance of Item.
321 322 323 324 325 326 327 |
# File 'lib/priority-queue/setup.rb', line 321 def initialize(name, template, default, desc) @name = name.freeze @template = template @value = default @default = default @description = desc end |
Instance Attribute Details
#default ⇒ Object Also known as: help_default
Returns the value of attribute default.
332 333 334 |
# File 'lib/priority-queue/setup.rb', line 332 def default @default end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
330 331 332 |
# File 'lib/priority-queue/setup.rb', line 330 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
329 330 331 |
# File 'lib/priority-queue/setup.rb', line 329 def name @name end |
Instance Method Details
#help_opt ⇒ Object
335 336 337 |
# File 'lib/priority-queue/setup.rb', line 335 def help_opt "--#{@name}=#{@template}" end |
#resolve(table) ⇒ Object
347 348 349 |
# File 'lib/priority-queue/setup.rb', line 347 def resolve(table) @value.gsub(%r<\$([^/]+)>) { table[$1] } end |
#set(val) ⇒ Object
351 352 353 |
# File 'lib/priority-queue/setup.rb', line 351 def set(val) @value = check(val) end |
#value ⇒ Object
343 344 345 |
# File 'lib/priority-queue/setup.rb', line 343 def value @value end |
#value? ⇒ Boolean
339 340 341 |
# File 'lib/priority-queue/setup.rb', line 339 def value? true end |