Skip to content

Instantly share code, notes, and snippets.

@rimian
Last active April 26, 2021 23:37
Show Gist options
  • Save rimian/4c1a3b380b0de83587dd83a11258543b to your computer and use it in GitHub Desktop.
Save rimian/4c1a3b380b0de83587dd83a11258543b to your computer and use it in GitHub Desktop.
module Merge
class Base
attr_accessor :base, :compare
def initialize(base, compare)
@base = base
@compare = compare
end
end
class MergeError < StandardError ; end
module ClassMethods
def find(base, compare)
new(base, compare)
end
end
def self.included(base)
base.extend ClassMethods
end
end
class MyModelMerge < Merge::Base
include Merge
def merge
puts 'merge'
puts base
puts compare
end
end
m = MyModelMerge.find(1, 2)
m.merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment