Sha256: f418ac330fd667362bf9b03887db7eb82787fa70bb2496d1a90473f9b8032886

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

module Tamashii
  module Agent
    module Device
      # :nodoc:
      class FakeLCD
        include Common::Loggable
        WIDTH = 16
        LINE_COUNT = 2

        attr_accessor :backlight

        def initialize
          @backlight = true
        end

        def print_message(message)
          lines = message.lines.map{|l| l.delete("\n")}
          logger.info "LCD Display(BACKLIGHT: #{@backlight}):"
          lines.take(LINE_COUNT).each_with_index { |line_text, line| print_line(line_text, line) }
        end

        def print_line(message, line)
          message = '' unless message
          message = message.ljust(WIDTH, ' ')
          message.split('').take(WIDTH).join('')
          logger.info "Line #{line}: #{message}"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tamashii-agent-0.3.0 lib/tamashii/agent/device/fake_lcd.rb
tamashii-agent-0.2.8 lib/tamashii/agent/device/fake_lcd.rb
tamashii-agent-0.2.7 lib/tamashii/agent/device/fake_lcd.rb
tamashii-agent-0.2.6 lib/tamashii/agent/device/fake_lcd.rb