Class: Glimmer::DataBinding::Tk::WidgetBinding

Inherits:
Object
  • Object
show all
Includes:
Glimmer, Observable, Observer
Defined in:
lib/glimmer/data_binding/tk/widget_binding.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(widget, attribute) ⇒ WidgetBinding

Returns a new instance of WidgetBinding.



34
35
36
37
# File 'lib/glimmer/data_binding/tk/widget_binding.rb', line 34

def initialize(widget, attribute)
  @widget = widget
  @attribute = attribute
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



33
34
35
# File 'lib/glimmer/data_binding/tk/widget_binding.rb', line 33

def attribute
  @attribute
end

#widgetObject (readonly)

Returns the value of attribute widget.



33
34
35
# File 'lib/glimmer/data_binding/tk/widget_binding.rb', line 33

def widget
  @widget
end

Instance Method Details

#call(value) ⇒ Object



39
40
41
# File 'lib/glimmer/data_binding/tk/widget_binding.rb', line 39

def call(value)
  @widget.set_attribute(@attribute, value) unless evaluate_attribute == value
end

#evaluate_attributeObject



43
44
45
# File 'lib/glimmer/data_binding/tk/widget_binding.rb', line 43

def evaluate_attribute
  @widget.get_attribute(@attribute)
end