class Bluepill::ProcessProxy

Attributes

attributes[R]
name[R]
watches[R]

Public Class Methods

new(process_name, attributes, process_block) click to toggle source
# File lib/bluepill/dsl/process_proxy.rb, line 4
def initialize(process_name, attributes, process_block)
  @name = process_name
  @attributes = attributes
  @watches = {}

  if process_block.arity.zero?
    instance_eval(&process_block)
  else
    instance_exec(self, &process_block)
  end
end

Public Instance Methods

checks(name, options = {}) click to toggle source
# File lib/bluepill/dsl/process_proxy.rb, line 30
def checks(name, options = {})
  @watches[name] = options
end
method_missing(name, *args) click to toggle source
Calls superclass method
# File lib/bluepill/dsl/process_proxy.rb, line 16
def method_missing(name, *args)
  if args.size == 1 && name.to_s =~ /^(.*)=$/
    @attributes[Regexp.last_match[1].to_sym] = args.first
  elsif args.size == 1
    @attributes[name.to_sym] = args.first
  elsif args.empty? && name.to_s =~ /^(.*)!$/
    @attributes[Regexp.last_match[1].to_sym] = true
  elsif args.empty? && @attributes.key?(name.to_sym)
    @attributes[name.to_sym]
  else
    super
  end
end
monitor_children(&child_process_block) click to toggle source
# File lib/bluepill/dsl/process_proxy.rb, line 34
def monitor_children(&child_process_block)
  @attributes[:monitor_children] = true
  @attributes[:child_process_block] = child_process_block
end
to_process() click to toggle source
# File lib/bluepill/dsl/process_proxy.rb, line 39
def to_process
  Process.new(@name, @watches, @attributes)
end