docs/operation.md in clowne-1.1.0 vs docs/operation.md in clowne-1.2.0
- old
+ new
@@ -1,9 +1,6 @@
----
-id: operation
-title: Operation
----
+# Operation
Since version 1.0 Clowne has been returning specific result object instead of a raw cloned object. It has allowed unifying interface between adapters and has opened an opportunity to implement new features. We call this object `Operation`.
An instance of `Operation` has a very clear interface:
@@ -16,11 +13,11 @@
after_persist do |_origin, cloned, **|
cloned.update_attributes(email: "evl-#{cloned.id}.ms")
end
end
-user = User.create(email: 'evl.ms')
+user = User.create(email: "evl.ms")
# => <#User id: 1, email: 'evl.ms', ...>
operation = UserCloner.call(user)
# Return resulted (non saved) object:
@@ -35,10 +32,10 @@
# => <#User id: 2, email: 'evl-2.ms', ...>
# Call only after_persist callbacks:
user2 = operation.to_record
# => <#User id: 2, email: 'evl-2.ms', ...>
-user2.update_attributes(email: 'admin@example.com')
+user2.update_attributes(email: "admin@example.com")
# => <#User id: 2, email: 'admin@example.com' ...>
operation.run_after_persist
# => <#User id: 2, email: 'evl-2.ms', ...>
```