Class: SandthornSequelProjection::Runner
- Inherits:
-
Object
- Object
- SandthornSequelProjection::Runner
- Defined in:
- lib/sandthorn_sequel_projection/runner.rb
Constant Summary collapse
- DEFAULT_INTERVAL =
0.5
Instance Attribute Summary collapse
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
Instance Method Summary collapse
-
#initialize(manifest, interval = DEFAULT_INTERVAL) ⇒ Runner
constructor
A new instance of Runner.
- #run(infinite = true) ⇒ Object
Constructor Details
#initialize(manifest, interval = DEFAULT_INTERVAL) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 |
# File 'lib/sandthorn_sequel_projection/runner.rb', line 8 def initialize(manifest, interval = DEFAULT_INTERVAL) @manifest = manifest @interval = interval end |
Instance Attribute Details
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
6 7 8 |
# File 'lib/sandthorn_sequel_projection/runner.rb', line 6 def interval @interval end |
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
6 7 8 |
# File 'lib/sandthorn_sequel_projection/runner.rb', line 6 def manifest @manifest end |
Instance Method Details
#run(infinite = true) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sandthorn_sequel_projection/runner.rb', line 13 def run(infinite = true) @projections = manifest.projections.map do |projection_class| projection_class.new(db_connection) end migrate! if infinite start_loop else loop_once end end |