Sha256: 5090055bb7474f703a2140aa2108193085abe8b9e55ea176e845a19a6f2f85be

Contents?: true

Size: 526 Bytes

Versions: 1

Compression:

Stored size: 526 Bytes

Contents

module Petli
  module Stages
    class Main < Base
      def actions
        return %w(light) if @pet.lights_out
        acts = %w(play feed light)
        acts << "clean" if @pet.poops.count > 0
        acts
      end

      def onkey(event)
        return @pet.light_switch if event.value == "l"
        return if @pet.lights_out
        return goto(Feed, pet: @pet) if event.value == "f"
        return @pet.clean if event.value == "c"
        return goto(Play, pet: @pet) if event.value == "p"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
petli-0.0.4 lib/petli/stages/main.rb