Class: RuGUI::PropertyChangedSupport::PropertyChangedBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/rugui/property_changed_support.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blockObject

Returns the value of attribute block.



57
58
59
# File 'lib/rugui/property_changed_support.rb', line 57

def block
  @block
end

#observerObject

Returns the value of attribute observer.



58
59
60
# File 'lib/rugui/property_changed_support.rb', line 58

def observer
  @observer
end

#optionsObject

Returns the value of attribute options.



56
57
58
# File 'lib/rugui/property_changed_support.rb', line 56

def options
  @options
end

#propertyObject

Returns the value of attribute property.



55
56
57
# File 'lib/rugui/property_changed_support.rb', line 55

def property
  @property
end

Instance Method Details

#call_property_changed_block_if_exists(observer, observable, property, new_value, old_value) ⇒ Object

Call the block configurated for the property changed if a block exists for the one.



61
62
63
64
# File 'lib/rugui/property_changed_support.rb', line 61

def call_property_changed_block_if_exists(observer, observable, property, new_value, old_value)
  self.observer = observer
  call_property_changed_block(observable, new_value, old_value) if block_exists?(observable, property, new_value, old_value)
end

#set_options(method_or_options) ⇒ Object

Set the options given the args.



67
68
69
70
71
72
73
74
# File 'lib/rugui/property_changed_support.rb', line 67

def set_options(method_or_options)
  case method_or_options
  when String, Symbol
    self.options = { :call => prepared(method_or_options) }
  when Hash
    self.options = method_or_options
  end
end