Sha256: 5cca304d3d3d0a3e71e9389bba601b388c3bb6d2e4c760feef2d72b2e007fc3e
Contents?: true
Size: 1.2 KB
Versions: 6
Compression:
Stored size: 1.2 KB
Contents
module ConfigmonkeyCli class Application module ManifestAction class Custom < Base def init label = nil, &block @label = label block.call(Proxy.new(self)) if block end def inspect @label ? super.gsub("Custom @args", "Custom @label=#{@label} @args") : super end def prepare status :proc, :yellow, (@label || "unlabeled custom block"), :blue end def simulate @args.each do |scope, block| block.call(self, manifest) if scope == :always || scope == :simulate end end def destructive @args.each do |scope, block| block.call(self, manifest) if scope == :always || scope == :destructive end end class Proxy attr_reader :action def initialize action @action = action end def always &block @action.args << [:always, block] end def simulate &block @action.args << [:simulate, block] end def destructive &block @action.args << [:destructive, block] end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems