Module: PgReports::SqlLoader
- Defined in:
- lib/pg_reports/sql_loader.rb
Overview
Loads and caches SQL queries from files
Constant Summary collapse
- SQL_DIR =
File.("sql", __dir__)
Class Method Summary collapse
Class Method Details
.clear_cache! ⇒ Object
14 15 16 |
# File 'lib/pg_reports/sql_loader.rb', line 14 def clear_cache! @sql_cache = {} end |
.load(category, name) ⇒ Object
9 10 11 12 |
# File 'lib/pg_reports/sql_loader.rb', line 9 def load(category, name) cache_key = "#{category}/#{name}" sql_cache[cache_key] ||= read_sql_file(category, name) end |