Sha256: d3f4114d289c3e39a43a87bdd8352513714bfd4dadb6a91331d87687266cbc84

Contents?: true

Size: 487 Bytes

Versions: 5

Compression:

Stored size: 487 Bytes

Contents

# Fake PiPiper
module PiPiper
  # Just enough to imitate a pin
  class Pin
    attr_reader :pin, :direction

    def initialize(options)
      @pin = options[:pin]
      @direction = options[:direction]
    end

    def read
      @value ||= 0
    end

    def on
      @value = 1

      log "Pin #{pin} on"
    end

    def off
      @value = 0

      log "Pin #{pin} off"
    end

    private

    def log(message)
      puts message unless ENV['RUBY_ENV'] == 'test'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
whipped-cream-0.2.0.beta1 lib/whipped-cream/pi_piper.rb
whipped-cream-0.1.1 lib/whipped-cream/pi_piper.rb
whipped-cream-0.1.0 lib/whipped-cream/pi_piper.rb
whipped-cream-0.0.1 lib/whipped-cream/pi_piper.rb
whipped-cream-0.0.1pre5 lib/whipped-cream/pi_piper.rb