Sha256: 63759e67eb85c5b6005d9d76b2d35131533964d90aaf9697e48081070fa07d3d

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

module Waddup

  # Denotes a possible source of events
  # Note: Any subclasses are automatically registered
  class Source
    extend Waddup::Registry

    # Aggregates events from this source
    #
    # Arguments:
    #
    #   :from (datetime)
    #   :to   (datetime)
    #
    def events(from, to)
      raise NotImplementedError
    end

    # Delegate for convenience
    def usable?
      self.class.usable?
    end

    class << self

      # Whether this source is usable
      def usable?
        raise NotImplementedError
      end

      # Only usable sources
      def usable
        registry.select &:usable?
      end

    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
waddup-0.2.2 lib/waddup/source.rb
waddup-0.2.1 lib/waddup/source.rb
waddup-0.2.0 lib/waddup/source.rb
waddup-0.1.0 lib/waddup/source.rb
waddup-0.0.2 lib/waddup/source.rb