Class: Trigger

Inherits:
SiteRecord show all
Defined in:
lib/yodel/models/core/functions/trigger.rb

Constant Summary

Constants inherited from AbstractRecord

AbstractRecord::CALLBACKS, AbstractRecord::FIELD_CALLBACKS, AbstractRecord::ORDERS

Instance Attribute Summary

Attributes inherited from SiteRecord

#site

Attributes inherited from AbstractRecord

#changed, #errors, #stash, #typecast, #values

Instance Method Summary collapse

Methods inherited from SiteRecord

#default_values, #initialize, #inspect_hash, #perform_reload, #prepare_reload_params, #site_id

Methods included from SiteModel

#load, #scoped, #scoped_for

Methods included from MongoModel

#collection, #load, #scoped

Methods included from AbstractModel

#embed_many, #embed_one, #field, #fields, #many, #modify_field, #one, #remove_field

Methods inherited from MongoRecord

#collection, #default_values, #fields, #id, #increment!, #inspect_hash, #load_from_mongo, #load_mongo_document, #perform_destroy, #perform_reload, #perform_save, #set_id

Methods inherited from AbstractRecord

#changed!, #changed?, #clear_key, #default_values, #destroy, #destroyed?, #eql?, #errors?, #field, #field?, #field_was, #fields, #from_json, #get, #get_meta, #get_raw, #hash, #id, #increment!, inherited, #initialize, #inspect, #inspect_hash, #inspect_value, #method_missing, #new?, #prepare_reload_params, #present?, #reload, #save, #save_without_validation, #search_terms, #set, #set_meta, #set_raw, #to_json, #to_str, #trigger_field_callback, #update, #valid?

Constructor Details

This class inherits a constructor from SiteRecord

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AbstractRecord

Instance Method Details

#compile_functionObject



7
8
9
# File 'lib/yodel/models/core/functions/trigger.rb', line 7

def compile_function
  self.instructions = Function.new(source).instructions
end

#run(record) ⇒ Object



11
12
13
# File 'lib/yodel/models/core/functions/trigger.rb', line 11

def run(record)
  Function.new(instructions).execute(record)
end