Skip to content

Commit 6a24307

Browse files
author
Joselito Tapangan
committed
Fix the error when it is in ruby version 2.0
1 parent 499d9b4 commit 6a24307

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/stackify-api-ruby.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def run async = true
107107
if Stackify.is_valid?
108108
at_exit { make_remained_job }
109109
t1 = Thread.new { Stackify.authorize }
110-
Stackify::EnvDetails.instance.set_rails_info if (Object.const_defined?('Rails::Info'))
110+
Stackify::EnvDetails.instance.set_rails_info
111111
case Stackify.configuration.mode
112112
when MODES[:both]
113113
t2 = start_logging

lib/stackify/env_details.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ def initialize
2525
end
2626

2727
def set_rails_info
28+
begin
29+
if (!Object.const_defined?('Rails::Info'))
30+
return
31+
end
32+
rescue NameError => exception
33+
return
34+
end
2835
rails_info = defined?(Rails) ? Rails::Info.properties.to_h : nil
2936
@info = rails_info || { 'Application root' => Dir.pwd, 'Environment' => 'development'}
3037
@request_details = {}

0 commit comments

Comments
 (0)