Module: Emote::Helpers

Included in:
YesMail, YesView
Defined in:
lib/yescode/emote.rb

Instance Method Summary collapse

Instance Method Details

#emote(file, params = {}, context = self) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/yescode/emote.rb', line 67

def emote(file, params = {}, context = self)
  file_cache[file] ||= File.read(file)
  key = params.hash + context.hash
  emote_cache[key] ||= Emote.parse(file_cache[file], context, params.keys, file)

  emote_cache[key][params]
end

#emote_cacheObject



75
76
77
# File 'lib/yescode/emote.rb', line 75

def emote_cache
  Thread.current[:_emote_cache] ||= {}
end

#file_cacheObject



79
80
81
# File 'lib/yescode/emote.rb', line 79

def file_cache
  Thread.current[:_file_cache] ||= {}
end