lib/bluepill/dsl/process_proxy.rb in bluepill-0.0.49 vs lib/bluepill/dsl/process_proxy.rb in bluepill-0.0.50

- old
+ new

@@ -5,15 +5,23 @@ def initialize(process_name, attributes, process_block) @name = process_name @attributes = attributes @watches = {} - process_block.call(self) + if process_block.arity == 0 + instance_eval &process_block + else + instance_exec(self, &process_block) + end end def method_missing(name, *args) if args.size == 1 && name.to_s =~ /^(.*)=$/ @attributes[$1.to_sym] = args.first + elsif args.size == 1 + @attributes[name.to_sym] = args.first + elsif args.size == 0 && name.to_s =~ /^(.*)!$/ + @attributes[$1.to_sym] = true elsif args.empty? && @attributes.key?(name.to_sym) @attributes[name.to_sym] else super end