Class: ConfigTable::Item

Inherits:
Object show all
Defined in:
lib/gems/xmpp4r-0.4/setup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, template, default, desc) ⇒ Item

Returns a new instance of Item.



319
320
321
322
323
324
325
# File 'lib/gems/xmpp4r-0.4/setup.rb', line 319

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.



330
331
332
# File 'lib/gems/xmpp4r-0.4/setup.rb', line 330

def default
  @default
end

#descriptionObject (readonly)

Returns the value of attribute description.



328
329
330
# File 'lib/gems/xmpp4r-0.4/setup.rb', line 328

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



327
328
329
# File 'lib/gems/xmpp4r-0.4/setup.rb', line 327

def name
  @name
end

Instance Method Details

#help_optObject



333
334
335
# File 'lib/gems/xmpp4r-0.4/setup.rb', line 333

def help_opt
  "--#{@name}=#{@template}"
end

#resolve(table) ⇒ Object



345
346
347
# File 'lib/gems/xmpp4r-0.4/setup.rb', line 345

def resolve(table)
  @value.gsub(%r<\$([^/]+)>) { table[$1] }
end

#set(val) ⇒ Object



349
350
351
# File 'lib/gems/xmpp4r-0.4/setup.rb', line 349

def set(val)
  @value = check(val)
end

#valueObject



341
342
343
# File 'lib/gems/xmpp4r-0.4/setup.rb', line 341

def value
  @value
end

#value?Boolean

Returns:

  • (Boolean)


337
338
339
# File 'lib/gems/xmpp4r-0.4/setup.rb', line 337

def value?
  true
end