Module: Mote::Helpers

Defined in:
lib/mote-angular.rb

Instance Method Summary collapse

Instance Method Details

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



53
54
55
56
57
58
59
60
# File 'lib/mote-angular.rb', line 53

def mote(file, params = {}, context = self)
  page_vars = "#{file}:pagevars"
  if !mote_cache[file] || mote_cache[page_vars] != params
    mote_cache[file] = Mote.parse(File.read(file), context, params.keys)
    mote_cache[page_vars] = params
  end
  mote_cache[file][params]
end

#mote_cacheObject



62
63
64
# File 'lib/mote-angular.rb', line 62

def mote_cache
  Thread.current[:_mote_cache] ||= {}
end