Module: RubyCurses::ConfigSetup

Overview

module eventh

Instance Method Summary collapse

Instance Method Details

#cget(param) ⇒ Object

returns param from hash. Unused and untested.



345
346
347
# File 'lib/rbcurse/rwidget.rb', line 345

def cget param
  @config[param]
end

#config_setup(aconfig) ⇒ Object

this bypasses our methods and sets directly !



349
350
351
352
353
354
355
356
357
# File 'lib/rbcurse/rwidget.rb', line 349

def config_setup aconfig
  @config = aconfig
  # this creates a problem in 1.9.2 since variable_set sets @config 2010-08-22 19:05 RK
  #@config.each_pair { |k,v| variable_set(k,v) }
  keys = @config.keys
  keys.each do |e| 
    variable_set(e, @config[e])
  end
end

#configure(*val, &block) ⇒ Object

instance_variable_set(nvar, val) # we should not call this !!! bypassing



333
334
335
336
337
338
339
340
341
342
# File 'lib/rbcurse/rwidget.rb', line 333

def configure(*val , &block)
  case val.size
  when 1
    return @config[val[0]]
  when 2
    @config[val[0]] = val[1]
    variable_set(val[0], val[1]) 
  end
  instance_eval &block if block_given?
end

#variable_set(var, val) ⇒ Object

private



328
329
330
331
332
# File 'lib/rbcurse/rwidget.rb', line 328

def variable_set var, val
  nvar = "@#{var}"
  send("#{var}", val)   # 2009-01-08 01:30 BIG CHANGE calling methods too here.
  #instance_variable_set(nvar, val)   # we should not call this !!! bypassing 
end