Class: Rinfo

Inherits:
Object
  • Object
show all
Defined in:
lib/rinfo.rb,
lib/rinfo/engine.rb,
lib/rinfo/version.rb

Defined Under Namespace

Classes: Engine

Constant Summary collapse

VERSION =
'0.1.4'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.filenameObject



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

def filename
  @filename ||= 'rinfo.json'
end

Class Method Details

.env_blacklistObject



24
25
26
# File 'lib/rinfo.rb', line 24

def env_blacklist
  @env_blacklist ||= [:prod, :production]
end

.env_blacklist=(args) ⇒ Object



28
29
30
# File 'lib/rinfo.rb', line 28

def env_blacklist=(args)
  @env_blacklist = [*args].map(&:to_sym)
end

.inform!Object



12
13
14
15
16
17
18
# File 'lib/rinfo.rb', line 12

def inform!
  if should_inform?
    JSON.pretty_generate(rinfo)
  else
    fail ActionController::RoutingError, 'Not Found'
  end
end

.should_inform?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/rinfo.rb', line 20

def should_inform?
  ([:all, env.to_sym] & env_blacklist).empty?
end