Class: Skywalking::Environment::SinatraFramework

Inherits:
Object
  • Object
show all
Defined in:
lib/skywalking/environment.rb

Instance Method Summary collapse

Instance Method Details

#app_nameObject



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/skywalking/environment.rb', line 55

def app_name
  candidate = ObjectSpace.each_object(Class).select { |klass| klass < ::Sinatra::Base } - [::Sinatra::Application]

  if candidate.length == 1
    candidate.first.name
  else
    "Sinatra"
  end
rescue
  "Sinatra"
end

#envObject



67
68
69
# File 'lib/skywalking/environment.rb', line 67

def env
  ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
end

#nameObject



47
48
49
# File 'lib/skywalking/environment.rb', line 47

def name
  :sinatra
end

#present?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/skywalking/environment.rb', line 51

def present?
  defined?(::Sinatra) && defined?(::Sinatra::Base)
end