Module: RailsIdle

Defined in:
lib/rails-idle.rb,
lib/rails-idle/web.rb,
lib/rails-idle/init.rb,
lib/rails-idle/report.rb,
lib/rails-idle/railtie.rb,
lib/rails-idle/storage.rb,
lib/rails-idle/version.rb,
lib/rails-idle/collector.rb,
lib/rails-idle/web_helpers.rb,
lib/rails-idle/storage/base.rb,
lib/rails-idle/tree_builder.rb,
lib/rails-idle/collector/base.rb,
lib/rails-idle/collector/views.rb,
lib/rails-idle/storage/rails_cache.rb

Defined Under Namespace

Modules: Collector, Storage, WebHelpers Classes: Railtie, Report, TreeBuilder, Web

Constant Summary collapse

DEFAULTS =
{
  collectors: RailsIdle::Collector.list,
  reset: false,
  cache: {
    :views => Pathname.new('/tmp/cache/rails-idle/views.cache'),
  },
}
VERSION =
'0.0.10'

Class Method Summary collapse

Class Method Details

.cache=(hash) ⇒ Object



42
43
44
45
46
# File 'lib/rails-idle.rb', line 42

def cache=(hash)
  hash.select{|key, _| DEFAULTS[:collectors].include? key}
  _cache = hash.symbolize_keys.select{|c, _| DEFAULTS[:collectors].include? c}
  options[:cache].merge!(_cache)
end

.collectorsObject



34
35
36
# File 'lib/rails-idle.rb', line 34

def collectors
  options[:collectors]
end

.collectors=(list) ⇒ Object



38
39
40
# File 'lib/rails-idle.rb', line 38

def collectors=(list)
  options[:collectors] = list.map(&:to_sym).select{|c| DEFAULTS[:collectors].include? c}
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (RailsIdle)

    the object that the method was called on



30
31
32
# File 'lib/rails-idle.rb', line 30

def configure
  yield self
end

.init!Object



3
4
5
6
# File 'lib/rails-idle/init.rb', line 3

def init!
  collect
  subscribe
end

.optionsObject



22
23
24
# File 'lib/rails-idle.rb', line 22

def options
  @options ||= DEFAULTS.dup
end

.options=(opts) ⇒ Object



26
27
28
# File 'lib/rails-idle.rb', line 26

def options=(opts)
  @options = opts
end

.reset=(value) ⇒ Object



52
53
54
# File 'lib/rails-idle.rb', line 52

def reset=(value)
  options[:reset] = value
end

.reset?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/rails-idle.rb', line 48

def reset?
  options[:reset]
end

.stylesheetsObject



56
57
58
# File 'lib/rails-idle.rb', line 56

def stylesheets
  @stylesheets ||= []
end

.stylesheets=(sheets = []) ⇒ Object



60
61
62
# File 'lib/rails-idle.rb', line 60

def stylesheets=(sheets = [])
  @stylesheets = sheets
end