Class: Fare::ConfigurationDSL::StackDSL
- Inherits:
-
Object
- Object
- Fare::ConfigurationDSL::StackDSL
- Defined in:
- lib/fare/configuration_dsl.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ StackDSL
constructor
A new instance of StackDSL.
- #listen_to(topic) ⇒ Object
- #parse(&block) ⇒ Object
- #run(&block) ⇒ Object
- #to_stack ⇒ Object
- #verify! ⇒ Object
Constructor Details
#initialize(configuration) ⇒ StackDSL
Returns a new instance of StackDSL.
98 99 100 101 102 |
# File 'lib/fare/configuration_dsl.rb', line 98 def initialize(configuration) @configuration = configuration @topics = [] @run = :not_specified end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
96 97 98 |
# File 'lib/fare/configuration_dsl.rb', line 96 def configuration @configuration end |
Instance Method Details
#listen_to(topic) ⇒ Object
122 123 124 |
# File 'lib/fare/configuration_dsl.rb', line 122 def listen_to(topic) @topics << Topic.new(topic) end |
#parse(&block) ⇒ Object
117 118 119 120 |
# File 'lib/fare/configuration_dsl.rb', line 117 def parse(&block) @source_location = block.source_location instance_eval(&block) end |
#run(&block) ⇒ Object
126 127 128 |
# File 'lib/fare/configuration_dsl.rb', line 126 def run(&block) @run = block end |
#to_stack ⇒ Object
113 114 115 |
# File 'lib/fare/configuration_dsl.rb', line 113 def to_stack SubscriberStack.new(configuration, @topics, @run) end |
#verify! ⇒ Object
104 105 106 107 108 109 110 111 |
# File 'lib/fare/configuration_dsl.rb', line 104 def verify! if @topics.empty? raise "Stack without topics for stack on line #{@source_location.last} of #{@source_location.first}" end if @run == :not_specified raise "No run list specified for stack on line #{@source_location.last} of #{@source_location.first}" end end |