Module: Surveyor::MustacheContext

Extended by:
ActiveSupport::Concern
Included in:
Surveyor::Models::AnswerMethods, Surveyor::Models::QuestionGroupMethods, Surveyor::Models::QuestionMethods
Defined in:
lib/surveyor/mustache_context.rb

Instance Method Summary collapse

Instance Method Details

#in_context(text, context = nil) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/surveyor/mustache_context.rb', line 5

def in_context(text, context=nil)
  case context
  when NilClass then text
  when Hash     then Mustache.render(text, context)
  else               context.render(text)
  end
end