Module: Glimpse

Defined in:
lib/glimpse.rb,
lib/glimpse/railtie.rb,
lib/glimpse/version.rb,
lib/glimpse/views/view.rb,
lib/glimpse/controller_helpers.rb

Defined Under Namespace

Modules: ControllerHelpers, Views Classes: Railtie

Constant Summary collapse

VERSION =
'0.0.5'

Class Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/glimpse.rb', line 10

def self.enabled?
  ['development', 'staging'].include?(env)
end

.envObject



14
15
16
# File 'lib/glimpse.rb', line 14

def self.env
  Rails.env
end

.into(klass, options = {}) ⇒ Object



26
27
28
29
# File 'lib/glimpse.rb', line 26

def self.into(klass, options = {})
  @views ||= []
  @views << [klass, options]
end

.resetObject



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

def self.reset
  @views = nil
  @cached_views = nil
end

.viewsObject



18
19
20
21
22
23
24
# File 'lib/glimpse.rb', line 18

def self.views
  @cached_views ||= if @views && @views.any?
    @views.collect { |klass, options| klass.new(options.dup) }.select(&:enabled?)
  else
    []
  end
end