Sha256: 9e067c4909df1d8b43f8887cdb2f4726bf3bc496b1717ee3108742d6d822e6da

Contents?: true

Size: 625 Bytes

Versions: 3

Compression:

Stored size: 625 Bytes

Contents

module Amoeba
  module Macros
    class Base
      def initialize(cloner)
        @cloner     = cloner
        @old_object = cloner.old_object
        @new_object = cloner.new_object
      end

      def follow(_relation_name, _association)
        fail "#{self.class.name} doesn't implement `follow`!"
      end

      class << self
        def inherited(klass)
          ::Amoeba::Macros.add(klass)
        end
      end

      def remapped_relation_name(name)
        return name unless @cloner.amoeba.remap_method
        @old_object.__send__(@cloner.amoeba.remap_method, name.to_sym) || name
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
amoeba-3.2.0 lib/amoeba/macros/base.rb
amoeba-3.1.0 lib/amoeba/macros/base.rb
amoeba-3.0.0 lib/amoeba/macros/base.rb