Class: Feeder::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/feeder/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



6
7
8
9
10
11
12
# File 'lib/feeder/configuration.rb', line 6

def initialize
  @scopes = [
    proc { order created_at: :desc }
  ]

  @observables = {}
end

Instance Attribute Details

#observablesObject

Returns the value of attribute observables.



4
5
6
# File 'lib/feeder/configuration.rb', line 4

def observables
  @observables
end

#scopesObject

Returns the value of attribute scopes.



3
4
5
# File 'lib/feeder/configuration.rb', line 3

def scopes
  @scopes
end

Instance Method Details

#add_observable(observable) ⇒ Object



14
15
16
17
18
# File 'lib/feeder/configuration.rb', line 14

def add_observable(observable)
  warn "[DEPRECATION] Feeder::Configuration.add_observable is deprecated. Please use Feeder::Configuration.observe instead."

  observe observable
end

#observe(observable, options = {}) ⇒ Object

Add an observable.

observable - A model to observe. options - A Hash of options:

:if - A lambda returning a boolean whether to create a feed item.


25
26
27
# File 'lib/feeder/configuration.rb', line 25

def observe(observable, options = {})
  @observables[observable] = options
end