class Slack::Observer

Attributes

blk[R]
func[R]
observer[R]
topic[RW]

Public Class Methods

new(topic=nil, observer=nil, func=:update, &blk) click to toggle source
# File lib/laziness/observer.rb, line 6
def initialize(topic=nil, observer=nil, func=:update, &blk)
  @topic = topic
  @observer = observer
  @func = func
  @blk = blk
end

Public Instance Methods

==(other) click to toggle source
# File lib/laziness/observer.rb, line 18
def ==(other)
  return false if other.nil?
  self.topic == other.topic && self.blk == other.blk &&
    self.observer == other.observer && self.func == other.func
end
execute(*args) click to toggle source
# File lib/laziness/observer.rb, line 13
def execute(*args)
  blk.call(*args) if blk
  observer.send func, *args if observer && observer.respond_to?(func)
end