Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (20 sloc) 442 Bytes
require "logger"
class LoggingListener
def initialize(io = $stdout)
@logger = Logger.new(io)
end
def call(entity, state)
@logger.info("#{entity_name(entity)} transitioned to #{state}")
end
private
def entity_name(entity)
case entity
when PillarCircle
"Pillar Circle"
when Pillar
"Pillar #{entity.number}"
else
raise ArgumentError, "Unknown entity #{entity.inspect}"
end
end
end
You can’t perform that action at this time.