Module: Card::Loader
- Defined in:
- lib/card/loader.rb
Class Method Summary collapse
Class Method Details
.load_chunks ⇒ Object
30 31 32 33 34 |
# File 'lib/card/loader.rb', line 30 def load_chunks mod_dirs.each do |mod| load_dir "#{mod}/chunk/*.rb" end end |
.load_layouts ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/card/loader.rb', line 36 def load_layouts mod_dirs.inject({}) do |hash, mod| dirname = "#{mod}/layout" if File.exists? dirname Dir.foreach( dirname ) do |filename| next if filename =~ /^\./ hash[ filename.gsub /\.html$/, '' ] = File.read( [dirname, filename] * '/' ) end end hash end end |
.load_mods ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/card/loader.rb', line 20 def load_mods load_set_patterns load_formats load_sets if Wagn.config.performance_logger Card::Log::Performance.load_config Wagn.config.performance_logger end end |
.mod_dirs ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/card/loader.rb', line 49 def mod_dirs @@mod_dirs ||= begin if Card.paths['local-mod'] Card.paths['mod'] << Card.paths['local-mod'] Rails.logger.warn 'DEPRECATION WARNING: Append to paths[\'mod\'] vs. local-mod for configuring location of local (deck) modules.' end Card.paths['mod'].existent.map do |dirname| Dir.entries( dirname ).sort.map do |filename| "#{dirname}/#{filename}" if filename !~ /^\./ end.compact end.flatten.compact end end |