Module: Morpheus::Mixins::Reflections::ClassMethods

Defined in:
lib/morpheus/mixins/reflections.rb

Instance Method Summary collapse

Instance Method Details

#create_reflection(macro, name, options) ⇒ Object



11
12
13
14
15
# File 'lib/morpheus/mixins/reflections.rb', line 11

def create_reflection(macro, name, options)
  Reflection.new(macro, name, options).tap do |reflection|
    reflections.merge!(name => reflection)
  end
end

#reflect_on_association(association) ⇒ Object



21
22
23
# File 'lib/morpheus/mixins/reflections.rb', line 21

def reflect_on_association(association)
  reflections[association.to_sym].is_a?(Reflection) ? reflections[association.to_sym] : nil
end

#reflectionsObject



17
18
19
# File 'lib/morpheus/mixins/reflections.rb', line 17

def reflections
  @reflections ||= {}
end