Module: UltraSettings::ViewHelper
- Defined in:
- lib/ultra_settings/view_helper.rb
Overview
Base class for rendering views.
Class Method Summary collapse
-
.app_dir ⇒ String
Get the app directory path.
-
.erb_template(path) ⇒ ERB
Get an ERB template for rendering.
-
.read_app_file(path) ⇒ String
Read a file from the app directory.
Class Method Details
.app_dir ⇒ String
Get the app directory path.
30 31 32 |
# File 'lib/ultra_settings/view_helper.rb', line 30 def app_dir File.(File.join("..", "..", "app"), __dir__) end |
.erb_template(path) ⇒ ERB
Get an ERB template for rendering.
13 14 15 16 |
# File 'lib/ultra_settings/view_helper.rb', line 13 def erb_template(path) @cache.clear if development_mode? @cache["erb:#{path}"] ||= ERB.new(read_app_file(path)) end |
.read_app_file(path) ⇒ String
Read a file from the app directory.
22 23 24 25 |
# File 'lib/ultra_settings/view_helper.rb', line 22 def read_app_file(path) @cache.clear if development_mode? @cache["file:#{path}"] ||= File.read(File.join(app_dir, path)) end |