Class: Fragmentary::Template
- Inherits:
-
Object
- Object
- Fragmentary::Template
- Defined in:
- lib/fragmentary/fragments_helper.rb
Overview
Just a wrapper to allow us to call a configurable current_user_method on the template
Instance Method Summary collapse
- #current_user ⇒ Object
-
#initialize(template) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(template) ⇒ Template
Returns a new instance of Template.
79 80 81 |
# File 'lib/fragmentary/fragments_helper.rb', line 79 def initialize(template) @template = template end |
Instance Method Details
#current_user ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/fragmentary/fragments_helper.rb', line 83 def current_user return nil unless methd = Fragmentary.current_user_method if @template.respond_to? methd @template.send methd else raise NoMethodError, "The current_user_method '#{methd.to_s}' specified doesn't exist" end end |