Module: Silencer::Environment

Defined in:
lib/silencer/rails/environment.rb

Constant Summary collapse

RAILS_4 =
/^4/
RAILS_5 =
/^5/

Class Method Summary collapse

Class Method Details

.rails4?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/silencer/rails/environment.rb', line 20

def rails4?
  rails_version =~ RAILS_4
end

.rails5?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/silencer/rails/environment.rb', line 24

def rails5?
  rails_version =~ RAILS_5
end

.rails?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/silencer/rails/environment.rb', line 10

def rails?
  defined?(::Rails)
end

.rails_versionObject



14
15
16
17
18
# File 'lib/silencer/rails/environment.rb', line 14

def rails_version
  return unless rails?

  ::Rails::VERSION::STRING
end

.tagged_logger?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/silencer/rails/environment.rb', line 28

def tagged_logger?
  rails4? || rails5?
end