module OceanDynamo::Associations::ClassMethods


Class methods

Public Instance Methods

clear_relations() click to toggle source
# File lib/ocean-dynamo/associations/associations.rb, line 59
def clear_relations
  self.relations = Hash.new
end
define_class_if_not_defined(class_name) click to toggle source
# File lib/ocean-dynamo/associations/associations.rb, line 70
def define_class_if_not_defined(class_name)
  Object.const_set(class_name, Class.new(OceanDynamo::Table)) unless const_defined?(class_name)
end
dynamo_schema(*) click to toggle source
Calls superclass method
# File lib/ocean-dynamo/associations/associations.rb, line 64
def dynamo_schema(*)
  clear_relations
  super
end
register_relation(klass, value) click to toggle source
# File lib/ocean-dynamo/associations/associations.rb, line 52
def register_relation(klass, value)
  relations[klass] = value
end
relates_to(klass) click to toggle source
# File lib/ocean-dynamo/associations/associations.rb, line 45
def relates_to(klass)
  relations[klass]
end
relations_of_type(rel_type) click to toggle source
# File lib/ocean-dynamo/associations/associations.rb, line 34
def relations_of_type(rel_type)
  relations.inject([]) do |acc, rel|
    kl, type = rel
    acc << kl if type == rel_type
    acc
  end
end