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.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.filenameObject



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

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

Class Method Details

.env_blacklistObject



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

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

.env_blacklist=(args) ⇒ Object



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

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

.inform!Object



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

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

.should_inform?Boolean

Returns:

  • (Boolean)


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

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