Class: OrderSend

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

Instance Method Summary collapse

Constructor Details

#initializeOrderSend

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_observersObject



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