Class: Batman::DefineViewHelper::BatmanView
- Inherits:
-
Object
- Object
- Batman::DefineViewHelper::BatmanView
- Defined in:
- lib/batman-rails/helpers/define_view_helper.rb
Constant Summary collapse
- PATH_TO_HTML =
"app/assets/batman/html/"
Instance Attribute Summary collapse
-
#path_to_html ⇒ Object
Returns the value of attribute path_to_html.
-
#pathname ⇒ Object
Returns the value of attribute pathname.
-
#render_context ⇒ Object
Returns the value of attribute render_context.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(pathname, render_context, options = {}) ⇒ BatmanView
constructor
A new instance of BatmanView.
- #inline_preload_javascript ⇒ Object
Constructor Details
#initialize(pathname, render_context, options = {}) ⇒ BatmanView
24 25 26 27 28 |
# File 'lib/batman-rails/helpers/define_view_helper.rb', line 24 def initialize(pathname, render_context, ={}) @pathname = pathname @render_context = render_context @path_to_html = [:path_to_html] || PATH_TO_HTML end |
Instance Attribute Details
#path_to_html ⇒ Object
Returns the value of attribute path_to_html.
13 14 15 |
# File 'lib/batman-rails/helpers/define_view_helper.rb', line 13 def path_to_html @path_to_html end |
#pathname ⇒ Object
Returns the value of attribute pathname.
13 14 15 |
# File 'lib/batman-rails/helpers/define_view_helper.rb', line 13 def pathname @pathname end |
#render_context ⇒ Object
Returns the value of attribute render_context.
13 14 15 |
# File 'lib/batman-rails/helpers/define_view_helper.rb', line 13 def render_context @render_context end |
Class Method Details
.all(render_context, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/batman-rails/helpers/define_view_helper.rb', line 15 def self.all(render_context, ={}) path_to_html = [:path_to_html] || PATH_TO_HTML glob_path = File.join(path_to_html, "**/*") valid_files = Dir.glob(glob_path).select { |pathname| File.file?(pathname) } valid_files.collect do |pathname| new(pathname, render_context, path_to_html: path_to_html) end end |
Instance Method Details
#inline_preload_javascript ⇒ Object
30 31 32 |
# File 'lib/batman-rails/helpers/define_view_helper.rb', line 30 def inline_preload_javascript %Q{Batman.View.store.set(#{name.to_json}, #{content.to_json});} end |