Sha256: 69fabd67b33609d5d2695ded06655129672a97422f6aa692825c53c09b6df6ac
Contents?: true
Size: 601 Bytes
Versions: 188
Compression:
Stored size: 601 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: class Javascript # Constant for the file that defines all the js functions. FUNCTIONS = File.join(File.dirname(__FILE__), "javascript", "functions.yml") # Load the javascript functions and define a class method for each one, # that memoizes the value. # # @example Get the function. # Mongoid::Javascript.aggregate YAML.load(File.read(FUNCTIONS)).each_pair do |key, function| (class << self; self; end).class_eval <<-EOT def #{key} @#{key} ||= "#{function}" end EOT end end end
Version data entries
188 entries across 96 versions & 4 rubygems