Class: MethodObserver
Direct Known Subclasses
Defined Under Namespace
Classes: ObserverCannotObserveTwiceError
Instance Attribute Summary collapse
-
#result ⇒ Object
Returns the value of attribute result.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
4 5 6 |
# File 'lib/method_observer.rb', line 4 def result @result end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
3 4 5 |
# File 'lib/method_observer.rb', line 3 def target @target end |
Class Method Details
.instances ⇒ Object
18 19 20 |
# File 'lib/method_observer.rb', line 18 def self.instances @instances ||= {} end |
.new(*args) ⇒ Object
22 23 24 25 26 |
# File 'lib/method_observer.rb', line 22 def self.new(*args) o = super instances[o.object_id] = o o end |
Instance Method Details
#observe(target) ⇒ Object
12 13 14 15 16 |
# File 'lib/method_observer.rb', line 12 def observe(target) raise ObserverCannotObserveTwiceError if @target @target = target make_observable(target) end |