Class: Lyre::App
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Lyre::App
- Defined in:
- lib/lyre/app.rb
Overview
NOTE: Not sure this is the right name for this class
Class Attribute Summary collapse
-
.setup_block ⇒ Object
Returns the value of attribute setup_block.
-
.teardown_block ⇒ Object
Returns the value of attribute teardown_block.
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.setup_block ⇒ Object
Returns the value of attribute setup_block.
13 14 15 |
# File 'lib/lyre/app.rb', line 13 def setup_block @setup_block end |
.teardown_block ⇒ Object
Returns the value of attribute teardown_block.
13 14 15 |
# File 'lib/lyre/app.rb', line 13 def teardown_block @teardown_block end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
10 11 12 |
# File 'lib/lyre/app.rb', line 10 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
10 11 12 |
# File 'lib/lyre/app.rb', line 10 def port @port end |
Class Method Details
.boot ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/lyre/app.rb', line 23 def boot instance = self.new! #maybe just new instance.startup instance end |
.setup(&block) ⇒ Object
15 16 17 |
# File 'lib/lyre/app.rb', line 15 def setup(&block) self.setup_block = block end |
.teardown(&block) ⇒ Object
19 20 21 |
# File 'lib/lyre/app.rb', line 19 def teardown(&block) self.teardown_block = block end |
Instance Method Details
#endpoint ⇒ Object
49 50 51 |
# File 'lib/lyre/app.rb', line 49 def endpoint "http://#{host}:#{port}" end |
#shutdown ⇒ Object
45 46 47 |
# File 'lib/lyre/app.rb', line 45 def shutdown self.class.teardown_block.call(self) if self.class.teardown_block end |
#startup ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/lyre/app.rb', line 32 def startup with_thin_runner do Capybara::Server.new(self).tap do |server| server.boot self.host = server.host self.port = server.port self.class.setup_block.call(self) if self.class.setup_block end end end |