Sha256: 6ae687a49ad083069b26eafcf9edf3e381d055adc16265b2e48004f4f463ea82
Contents?: true
Size: 596 Bytes
Versions: 47
Compression:
Stored size: 596 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: # # <tt>Mongoid::Javascript.aggregate</tt> 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
47 entries across 47 versions & 9 rubygems