Class: Broadway::Sinatra::Processor
- Inherits:
-
Object
- Object
- Broadway::Sinatra::Processor
- Defined in:
- lib/broadway/sinatra/processor.rb
Instance Attribute Summary collapse
-
#paths ⇒ Object
Returns the value of attribute paths.
-
#site ⇒ Object
Returns the value of attribute site.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #error?(response, path, whiny = true) ⇒ Boolean
-
#initialize(site, url = nil) ⇒ Processor
constructor
A new instance of Processor.
- #path(path) ⇒ Object
- #run(&block) ⇒ Object
- #setting(name) ⇒ Object
Constructor Details
Instance Attribute Details
#paths ⇒ Object
Returns the value of attribute paths.
7 8 9 |
# File 'lib/broadway/sinatra/processor.rb', line 7 def paths @paths end |
#site ⇒ Object
Returns the value of attribute site.
7 8 9 |
# File 'lib/broadway/sinatra/processor.rb', line 7 def site @site end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/broadway/sinatra/processor.rb', line 7 def url @url end |
Instance Method Details
#error?(response, path, whiny = true) ⇒ Boolean
18 19 20 21 22 23 24 25 |
# File 'lib/broadway/sinatra/processor.rb', line 18 def error?(response, path, whiny = true) if !response.is_a?(Net::HTTPSuccess) raise if whiny puts "Error at '#{path}': #{response.to_s}" return true end false end |
#path(path) ⇒ Object
27 28 29 |
# File 'lib/broadway/sinatra/processor.rb', line 27 def path(path) self.paths << path end |
#run(&block) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/broadway/sinatra/processor.rb', line 31 def run(&block) self.paths = [] if block_given? self.instance_eval(&block) self.paths.reverse! requests end |
#setting(name) ⇒ Object
14 15 16 |
# File 'lib/broadway/sinatra/processor.rb', line 14 def setting(name) Sinatra::Application.send(name).to_s end |