Class: Bitcharts::ApplicationController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/bitcharts/application_controller.rb

Direct Known Subclasses

DaysController

Instance Method Summary collapse

Instance Method Details

#filesObject



16
17
18
# File 'app/controllers/bitcharts/application_controller.rb', line 16

def files
  load_paths.flatten.compact.uniq.flat_map{ |path| Dir["#{path}/**/*.rb"] }
end

#load_chartsObject



9
10
11
12
13
14
# File 'app/controllers/bitcharts/application_controller.rb', line 9

def load_charts
  unless loaded?
    files.each{ |file| require_dependency(file) }
    @@loaded = true
  end
end

#load_pathsObject



5
6
7
# File 'app/controllers/bitcharts/application_controller.rb', line 5

def load_paths
  [File.expand_path('app/charts', Rails.root)]
end

#loaded?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/controllers/bitcharts/application_controller.rb', line 20

def loaded?
  Rails.configuration.eager_load || (@@loaded ||= false)
end