Sha256: 37ee255175e4ba7b2f071097b3a8adaf33f1e5da85f8935a3b7cda96a21d8f22
Contents?: true
Size: 661 Bytes
Versions: 19
Compression:
Stored size: 661 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Gator 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 end
Version data entries
19 entries across 19 versions & 1 rubygems