Class: OrderSend
- Inherits:
-
Object
- Object
- OrderSend
- Defined in:
- lib/pricing_observer.rb
Instance Method Summary collapse
- #add_observer(observer) ⇒ Object
- #delete_observer(observer) ⇒ Object
-
#initialize ⇒ OrderSend
constructor
A new instance of OrderSend.
- #notify_observers ⇒ Object
Constructor Details
#initialize ⇒ OrderSend
Returns a new instance of OrderSend.
3 4 5 |
# File 'lib/pricing_observer.rb', line 3 def initialize @observers=[] end |
Instance Method Details
#add_observer(observer) ⇒ Object
7 8 9 |
# File 'lib/pricing_observer.rb', line 7 def add_observer(observer) @observers << observer end |
#delete_observer(observer) ⇒ Object
11 12 13 |
# File 'lib/pricing_observer.rb', line 11 def delete_observer(observer) @observers.delete(observer) end |
#notify_observers ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/pricing_observer.rb', line 15 def notify_observers @observers.each do |observer| puts "Notifying" observer.pricing_by_hit puts "Notified the observer" end end |