Last active
April 26, 2021 23:37
-
-
Save rimian/4c1a3b380b0de83587dd83a11258543b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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