Module: NimbleNodes::App

Defined in:
lib/nimble_nodes/app.rb

Class Method Summary collapse

Class Method Details

.nameObject

set through Heroku API when app is created



22
23
24
# File 'lib/nimble_nodes/app.rb', line 22

def self.name
  ENV['NIMBLE_NODES_APP_NAME']
end

.path(subpath = '/') ⇒ Object

path at server for calling app resource and subresources



37
38
39
40
41
# File 'lib/nimble_nodes/app.rb', line 37

def self.path(subpath='/')
  name = NimbleNodes::App.name
  return nil if name.nil?
  '/' + name + subpath
end

.rails?Boolean

Rails

Returns:

  • (Boolean)


7
8
9
# File 'lib/nimble_nodes/app.rb', line 7

def self.rails?
  defined?(RAILS_GEM_VERSION) ? true : false
end

.rails_versionObject



11
12
13
# File 'lib/nimble_nodes/app.rb', line 11

def self.rails_version
  RAILS_GEM_VERSION.slice(0..2).to_f
end

.reporterObject

returns path to platform specific report implementation



44
45
46
47
# File 'lib/nimble_nodes/app.rb', line 44

def self.reporter
  path = NimbleNodes::App.use_rails_filter? ? '/rails/filter' : '/middleware'
  NimbleNodes.lib_path(path)
end

.tokenObject

set through Heroku API when app is created at server



27
28
29
# File 'lib/nimble_nodes/app.rb', line 27

def self.token
  ENV['NIMBLE_NODES_APP_TOKEN']
end

.token?Boolean

returns true if app has been setup at server correctly

Returns:

  • (Boolean)


32
33
34
# File 'lib/nimble_nodes/app.rb', line 32

def self.token?
  not NimbleNodes::App.token.nil?
end

.use_rails_filter?Boolean

Check Rails version

returns true if gem is loaded in a pre 2.3 version of rails

Returns:

  • (Boolean)


17
18
19
# File 'lib/nimble_nodes/app.rb', line 17

def self.use_rails_filter?
  NimbleNodes::App.rails? and NimbleNodes::App.rails_version < 2.3
end