Class: ConfigTable::ExecItem
- Inherits:
-
Item
- Object
- Item
- ConfigTable::ExecItem
show all
- Defined in:
- lib/priority-queue/setup.rb
Instance Attribute Summary
Attributes inherited from Item
#default, #description, #name
Instance Method Summary
collapse
Methods inherited from Item
#help_opt, #set, #value
Constructor Details
#initialize(name, selection, desc, &block) ⇒ ExecItem
Returns a new instance of ExecItem.
423
424
425
426
427
|
# File 'lib/priority-queue/setup.rb', line 423
def initialize(name, selection, desc, &block)
super name, selection, nil, desc
@ok = selection.split('/')
@action = block
end
|
Instance Method Details
#config_type ⇒ Object
429
430
431
|
# File 'lib/priority-queue/setup.rb', line 429
def config_type
'exec'
end
|
#evaluate(val, table) ⇒ Object
443
444
445
446
447
448
449
|
# File 'lib/priority-queue/setup.rb', line 443
def evaluate(val, table)
v = val.strip.downcase
unless @ok.include?(v)
setup_rb_error "invalid option --#{@name}=#{val} (use #{@template})"
end
@action.call v, table
end
|
#resolve(table) ⇒ Object
437
438
439
|
# File 'lib/priority-queue/setup.rb', line 437
def resolve(table)
setup_rb_error "$#{name()} wrongly used as option value"
end
|
#value? ⇒ Boolean
433
434
435
|
# File 'lib/priority-queue/setup.rb', line 433
def value?
false
end
|