Class: Coverband::RackServerCheck
- Inherits:
-
Object
- Object
- Coverband::RackServerCheck
- Defined in:
- lib/coverband/integrations/rack_server_check.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(stack) ⇒ RackServerCheck
constructor
A new instance of RackServerCheck.
- #rack_server? ⇒ Boolean
- #rails_server? ⇒ Boolean
- #running? ⇒ Boolean
Constructor Details
#initialize(stack) ⇒ RackServerCheck
Returns a new instance of RackServerCheck.
9 10 11 |
# File 'lib/coverband/integrations/rack_server_check.rb', line 9 def initialize(stack) @stack = stack end |
Class Method Details
.running? ⇒ Boolean
5 6 7 |
# File 'lib/coverband/integrations/rack_server_check.rb', line 5 def self.running? new(Kernel.caller_locations).running? end |
Instance Method Details
#rack_server? ⇒ Boolean
17 18 19 |
# File 'lib/coverband/integrations/rack_server_check.rb', line 17 def rack_server? @stack.any? { |line| line.path.include?("lib/rack/") } end |
#rails_server? ⇒ Boolean
21 22 23 24 25 26 |
# File 'lib/coverband/integrations/rack_server_check.rb', line 21 def rails_server? @stack.any? do |location| location.path.include?("rails/commands/commands_tasks.rb") && location.label == "server" || location.path.include?("rails/commands/server/server_command.rb") && location.label == "perform" end end |
#running? ⇒ Boolean
13 14 15 |
# File 'lib/coverband/integrations/rack_server_check.rb', line 13 def running? rack_server? || rails_server? end |