Sha256: 9797f12d709abc1c773082445d8fb3ed2b10ff0005ecc3fde541b55fde95e6fe

Contents?: true

Size: 698 Bytes

Versions: 9

Compression:

Stored size: 698 Bytes

Contents

module WhippedCream
  # Data representation of a Plugin
  class Plugin
    attr_accessor :camera, :name

    def self.build(&block)
      Builder.build(&block)
    end

    def self.from_file(path)
      Builder.from_file(path)
    end

    def self.from_string(string)
      Builder.from_string(string)
    end

    def controls
      @controls ||= []
    end

    def buttons
      controls.select { |control| control.is_a? Button }
    end

    def fields
      controls.select { |control| control.is_a? Field }
    end

    def sensors
      controls.select { |control| control.is_a? Sensor }
    end

    def switches
      controls.select { |control| control.is_a? Switch }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
whipped-cream-0.2.0.beta1 lib/whipped-cream/plugin.rb
whipped-cream-0.1.1 lib/whipped-cream/plugin.rb
whipped-cream-0.1.0 lib/whipped-cream/plugin.rb
whipped-cream-0.0.1 lib/whipped-cream/plugin.rb
whipped-cream-0.0.1pre5 lib/whipped-cream/plugin.rb
whipped-cream-0.0.1pre4 lib/whipped-cream/plugin.rb
whipped-cream-0.0.1pre3 lib/whipped-cream/plugin.rb
whipped-cream-0.0.1pre2 lib/whipped-cream/plugin.rb
whipped-cream-0.0.1pre1 lib/whipped-cream/plugin.rb