Class: Rivendell::Import::Context
- Inherits:
-
Object
- Object
- Rivendell::Import::Context
- Defined in:
- lib/rivendell/import/context.rb
Instance Attribute Summary collapse
-
#task ⇒ Object
readonly
Returns the value of attribute task.
Instance Method Summary collapse
-
#initialize(task) ⇒ Context
constructor
A new instance of Context.
- #log(message) ⇒ Object
- #notify(target, options = {}) ⇒ Object
- #run(&block) ⇒ Object
- #with(expression) ⇒ Object
Constructor Details
#initialize(task) ⇒ Context
Returns a new instance of Context.
6 7 8 |
# File 'lib/rivendell/import/context.rb', line 6 def initialize(task) @task = task end |
Instance Attribute Details
#task ⇒ Object (readonly)
Returns the value of attribute task.
4 5 6 |
# File 'lib/rivendell/import/context.rb', line 4 def task @task end |
Instance Method Details
#log(message) ⇒ Object
23 24 25 |
# File 'lib/rivendell/import/context.rb', line 23 def log() logger.info if end |
#notify(target, options = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rivendell/import/context.rb', line 16 def notify(target, = {}) Rivendell::Import::Notifier::Base.notify(target, ).tap do |notifier| logger.debug "Will notify with #{notifier.inspect}" task.notifiers << notifier end end |
#run(&block) ⇒ Object
27 28 29 |
# File 'lib/rivendell/import/context.rb', line 27 def run(&block) instance_exec file, &block if block_given? end |
#with(expression) ⇒ Object
12 13 14 |
# File 'lib/rivendell/import/context.rb', line 12 def with(expression) yield if file.match expression end |