Module: Sinatra::JstPages::Helpers

Defined in:
lib/furnace-xray/lib/jst_pages.rb

Instance Method Summary collapse

Instance Method Details

#jst_filesObject

Returns a list of JST files.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/furnace-xray/lib/jst_pages.rb', line 115

def jst_files
  # Tuples of [ name, Engine instance ]
  tuples = Dir.chdir(settings.views) {
    Dir["**/*.jst.*"].map { |fn|
      fn       =~ %r{^(.*)\.jst\.([^\.]+)$}
      name, ext = $1, $2
      engine    = JstPages.mappings[ext]

      [ name, engine.new(File.join(settings.views, fn)) ]  if engine
    }.compact
  }

  Hash[*tuples.flatten]
end