class Coverband::RackServerCheck

Public Class Methods

new(stack) click to toggle source
# File lib/coverband/integrations/rack_server_check.rb, line 9
def initialize(stack)
  @stack = stack
end
running?() click to toggle source
# File lib/coverband/integrations/rack_server_check.rb, line 5
def self.running?
  new(Kernel.caller_locations).running?
end

Public Instance Methods

rack_server?() click to toggle source
# File lib/coverband/integrations/rack_server_check.rb, line 17
def rack_server?
  @stack.any? { |line| line.path.include?("lib/rack/") }
end
rails_server?() click to toggle source
# 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?() click to toggle source
# File lib/coverband/integrations/rack_server_check.rb, line 13
def running?
  rack_server? || rails_server?
end