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



721
722
723
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 721

def cget param
  @config[param]
end

#config_setup(aconfig) ⇒ Object

this bypasses our methods and sets directly !

Since:

  • 1.2.0



725
726
727
728
729
730
731
732
733
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 725

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



709
710
711
712
713
714
715
716
717
718
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 709

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



701
702
703
704
705
706
707
708
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 701

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