Sha256: 49bf0dd673b340fb7958b20967e0e04a63af74ebc54863b30d810bde54287457

Contents?: true

Size: 746 Bytes

Versions: 7

Compression:

Stored size: 746 Bytes

Contents

require 'tamashii/agent/component'
require 'tamashii/agent/event'
require 'tamashii/agent/adapter/buzzer'

module Tamashii
  module Agent
    class Buzzer < Component
      def initialize(master)
        super
        @buzzer = Adapter::Buzzer.object
        logger.debug "Using buzzer instance: #{@buzzer.class}"
      end

      def process_event(event)
        case event.type
        when Event::BEEP
          logger.debug "Beep: #{event.body}"
          case event.body
          when "ok"
            @buzzer.play_ok
          when "no"
            @buzzer.play_no
          when "error"
            @buzzer.play_error
          end
        end
      end

      def clean_up
        super
        @buzzer.stop
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tamashii-agent-0.3.0 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.2.8 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.2.7 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.2.6 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.2.5 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.2.4 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.2.3 lib/tamashii/agent/buzzer.rb