Class: ActiveTouch::Network
- Inherits:
-
Object
- Object
- ActiveTouch::Network
- Defined in:
- lib/active_touch/network.rb
Instance Attribute Summary collapse
-
#map ⇒ Object
Returns the value of attribute map.
Instance Method Summary collapse
- #add_touch(caller, touched, watch) ⇒ void
-
#initialize ⇒ Network
constructor
A new instance of Network.
Constructor Details
#initialize ⇒ Network
Returns a new instance of Network.
15 16 17 |
# File 'lib/active_touch/network.rb', line 15 def initialize @map = {} end |
Instance Attribute Details
#map ⇒ Object
Returns the value of attribute map.
13 14 15 |
# File 'lib/active_touch/network.rb', line 13 def map @map end |
Instance Method Details
#add_touch(caller, touched, watch) ⇒ void
This method returns an undefined value.
23 24 25 26 27 28 29 30 31 |
# File 'lib/active_touch/network.rb', line 23 def add_touch(caller, touched, watch) map[caller] ||= [] if touched.is_a? Array touched.each { |t| map[caller] << { class: t, attributes: watch } } else map[caller] << { class: touched, attributes: watch } end end |