Class: ActiveTouch::Network

Inherits:
Object
  • Object
show all
Defined in:
lib/active_touch/network.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNetwork

Returns a new instance of Network.



15
16
17
# File 'lib/active_touch/network.rb', line 15

def initialize
  @map = {}
end

Instance Attribute Details

#mapObject

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.

Parameters:

  • caller (String)
  • touched (String, Array(String))
  • watch (Array(Symbol))


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