Class: ConfigTable::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/priority-queue/setup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#defaultObject 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

#descriptionObject (readonly)

Returns the value of attribute description.



330
331
332
# File 'lib/priority-queue/setup.rb', line 330

def description
  @description
end

#nameObject (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_optObject



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

#valueObject



343
344
345
# File 'lib/priority-queue/setup.rb', line 343

def value
  @value
end

#value?Boolean

Returns:

  • (Boolean)


339
340
341
# File 'lib/priority-queue/setup.rb', line 339

def value?
  true
end