Sha256: 743c597a0cea6ae8bd0c005575687686c8da4b7a0869294c6c59b2cc34f70009

Contents?: true

Size: 611 Bytes

Versions: 8

Compression:

Stored size: 611 Bytes

Contents

module SearchKit
  module Models
    class Events
      include Enumerable

      def self.[](*arguments)
        new(arguments)
      end

      attr_reader :contents, :member_class

      def initialize(contents = [])
        @contents     = contents
        @member_class = SearchKit::Models::Event
      end

      def <<(new_event)
        case new_event
        when Hash         then contents << member_class.new(new_event)
        when member_class then contents << new_event
        else contents
        end
      end

      def each(&block)
        contents.each(&block)
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
search-kit-0.0.10 lib/search_kit/models/events.rb
search-kit-0.0.9 lib/search_kit/models/events.rb
search-kit-0.0.8 lib/search_kit/models/events.rb
search-kit-0.0.7 lib/search_kit/models/events.rb
search-kit-0.0.6 lib/search_kit/models/events.rb
search-kit-0.0.5 lib/search_kit/models/events.rb
search-kit-0.0.4 lib/search_kit/models/events.rb
search-kit-0.0.3 lib/search_kit/models/events.rb