Class: Feeder::Configuration
- Inherits:
-
Object
- Object
- Feeder::Configuration
- Defined in:
- lib/feeder/configuration.rb
Instance Attribute Summary collapse
-
#observables ⇒ Object
Returns the value of attribute observables.
-
#scopes ⇒ Object
Returns the value of attribute scopes.
Instance Method Summary collapse
- #add_observable(observable) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#observe(observable, options = {}) ⇒ Object
Add an observable.
Constructor Details
#initialize ⇒ Configuration
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
#observables ⇒ Object
Returns the value of attribute observables.
4 5 6 |
# File 'lib/feeder/configuration.rb', line 4 def observables @observables end |
#scopes ⇒ Object
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, = {}) @observables[observable] = end |