Sha256: 86fde962dad09129ac9a5ca2d1a4da96ab240013ee61520b1b94a6e1dacd605f

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

module ResourceKit
  class ResourceCollection
    extend Forwardable
    def_delegators :@collection, :find, :<<, :each, :include?

    def initialize
      @collection = []
    end

    def action(name, &block)
      action = Action.new(name)
      action.instance_eval(&block) if block_given?
      action.tap {|a| self << a }
    end

    def find_action(name)
      find do |action|
        action.name == name
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resource_kit-0.0.1 lib/resource_kit/resource_collection.rb