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.
29 30 31 |
# File 'lib/ultra_settings/view_helper.rb', line 29 def app_dir File.(File.join("..", "..", "app"), __dir__) end |
.erb_template(path) ⇒ ERB
Get an ERB template for rendering.
14 15 16 |
# File 'lib/ultra_settings/view_helper.rb', line 14 def erb_template(path) fetch("erb:#{path}") { ERB.new(read_app_file(path)) } end |
.read_app_file(path) ⇒ String
Read a file from the app directory.
22 23 24 |
# File 'lib/ultra_settings/view_helper.rb', line 22 def read_app_file(path) fetch("file:#{path}") { File.read(File.join(app_dir, path), encoding: Encoding::UTF_8) } end |