module SimpleFeed::Providers

Constants

ACTIVITY_METHODS

These methods must be implemented by each Provider, and operation on a given set of users passed via the user_ids: parameter.

FEED_METHODS

These optional methods must be implemented in order to gather statistics about each provider's memory consumption and state.

REQUIRED_METHODS
RUBY_MAJOR_VERSION

Public Class Methods

define_provider_methods(klass, prefix = nil, &block) click to toggle source
# File lib/simplefeed/providers.rb, line 41
def self.define_provider_methods(klass, prefix = nil, &block)
  # Methods on the class instance
  klass.class_eval do
    SimpleFeed::Providers::REQUIRED_METHODS.each do |m|
      method_name = prefix ? "#{prefix}_#{m}".to_sym : m
      define_method(method_name) do |*args, **opts, &b|
        block.call(self, m, *args, **opts, &b)
      end
    end
  end
end
register(provider_name, provider_class) click to toggle source
# File lib/simplefeed/providers.rb, line 14
def self.register(provider_name, provider_class)
  registry[provider_name] = provider_class
end
registry() click to toggle source
# File lib/simplefeed/providers.rb, line 10
def self.registry
  @registry
end