瀏覽代碼

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
     )
     )
   end
   end
 
 
+  def dry_run?
+    is_a? Sandbox
+  end
+
   module Sandbox
   module Sandbox
     attr_accessor :results
     attr_accessor :results