Module: TurboBoost::Elements::ApplicationHelper
- Defined in:
- app/helpers/turbo_boost/elements/application_helper.rb
Instance Method Summary collapse
-
#current_partial_path ⇒ Object
Returns an idiomatic path for the currently rendering template i.e.
- #method_missing(name) ⇒ Object
- #respond_to_missing?(name) ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/helpers/turbo_boost/elements/application_helper.rb', line 12 def method_missing(name, ...) prefixes = %w[toggle_] prefixes.each do |prefix| next unless name.start_with?(prefix) return send(:"#{prefix}tag_builder").public_send(name.to_s.delete_prefix(prefix), ...) end super end |
Instance Method Details
#current_partial_path ⇒ Object
Returns an idiomatic path for the currently rendering template i.e. How you’d pass the path to a ‘render partial: …` call
8 9 10 |
# File 'app/helpers/turbo_boost/elements/application_helper.rb', line 8 def current_partial_path @virtual_path.to_s.gsub("/_", "/") end |
#respond_to_missing?(name) ⇒ Boolean
21 22 23 24 25 26 27 28 |
# File 'app/helpers/turbo_boost/elements/application_helper.rb', line 21 def respond_to_missing?(name, ...) prefixes = %w[toggle_] prefixes.each do |prefix| next unless name.start_with?(prefix) return send(:"#{prefix}tag_builder").respond_to_missing?(name.to_s.delete_prefix(prefix), ...) end super end |