Define DryRunnable#dry_run?

A dry-runnable Agent can use this method to decide if it should avoid
affecting unsandboxed resources, like calling an external API that
might change any state.

Akinori MUSHA 10 年之前
父节点
当前提交
40d6192070
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      app/concerns/dry_runnable.rb

+ 4 - 0
app/concerns/dry_runnable.rb

@@ -25,6 +25,10 @@ module DryRunnable
25 25
     )
26 26
   end
27 27
 
28
+  def dry_run?
29
+    is_a? Sandbox
30
+  end
31
+
28 32
   module Sandbox
29 33
     attr_accessor :results
30 34