Module: RubyCurses::ConfigSetup

Included in:
ListCellRenderer, TreeCellRenderer, Widget
Defined in:
lib/rbcurse/core/widgets/rwidget.rb

Overview

module eventh

Since:

  • 1.2.0

Instance Method Summary collapse

Instance Method Details

#cget(param) ⇒ Object

returns param from hash. Unused and untested.

Since:

  • 1.2.0



733
734
735
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 733

def cget param
  @config[param]
end

#config_setup(aconfig) ⇒ Object

this bypasses our methods and sets directly !

Since:

  • 1.2.0



737
738
739
740
741
742
743
744
745
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 737

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

2011-11-20 NOTE i don;t know why i commented off rescue, but i am wondering we should respect attr_accessor, to make it easy. if respond_to? :var=

then set it, else call send. I'd ilke to phase out dsl_accessor.

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

Since:

  • 1.2.0



721
722
723
724
725
726
727
728
729
730
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 721

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

Since:

  • 1.2.0



713
714
715
716
717
718
719
720
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 713

def variable_set var, val
  #nvar = "@#{var}"
  send("#{var}", val) #rescue send("#{var}=", val)    # 2009-01-08 01:30 BIG CHANGE calling methods too here.
  # 2011-11-20 NOTE i don;t know why i commented off rescue, but i am wondering
  # we should respect attr_accessor, to make it easy. if respond_to? :var=
  #  then set it, else call send. I'd ilke to phase out dsl_accessor.
  #instance_variable_set(nvar, val)   # we should not call this !!! bypassing 
end