Class: Fragmentary::Template

Inherits:
Object
  • Object
show all
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

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_userObject



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