Class: EventedBluepill::ProcessProxy
- Inherits:
-
Object
- Object
- EventedBluepill::ProcessProxy
- Defined in:
- lib/evented_bluepill/dsl/process_proxy.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#watches ⇒ Object
readonly
Returns the value of attribute watches.
Instance Method Summary collapse
- #checks(name, options = {}) ⇒ Object
-
#initialize(process_name, attributes, process_block) ⇒ ProcessProxy
constructor
A new instance of ProcessProxy.
- #method_missing(name, *args) ⇒ Object
- #monitor_children(&child_process_block) ⇒ Object
- #to_process ⇒ Object
Constructor Details
#initialize(process_name, attributes, process_block) ⇒ ProcessProxy
Returns a new instance of ProcessProxy.
8 9 10 11 12 13 14 |
# File 'lib/evented_bluepill/dsl/process_proxy.rb', line 8 def initialize(process_name, attributes, process_block) @name = process_name @attributes = attributes @watches = {} process_block.call(self) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/evented_bluepill/dsl/process_proxy.rb', line 16 def method_missing(name, *args) if args.size == 1 && name.to_s =~ /^(.*)=$/ @attributes[$1.to_sym] = args.first elsif args.empty? && @attributes.key?(name.to_sym) @attributes[name.to_sym] else super end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/evented_bluepill/dsl/process_proxy.rb', line 7 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/evented_bluepill/dsl/process_proxy.rb', line 7 def name @name end |
#watches ⇒ Object (readonly)
Returns the value of attribute watches.
7 8 9 |
# File 'lib/evented_bluepill/dsl/process_proxy.rb', line 7 def watches @watches end |
Instance Method Details
#checks(name, options = {}) ⇒ Object
26 27 28 |
# File 'lib/evented_bluepill/dsl/process_proxy.rb', line 26 def checks(name, = {}) @watches[name] = end |
#monitor_children(&child_process_block) ⇒ Object
30 31 32 33 |
# File 'lib/evented_bluepill/dsl/process_proxy.rb', line 30 def monitor_children(&child_process_block) @attributes[:monitor_children] = true @attributes[:child_process_block] = child_process_block end |
#to_process ⇒ Object
35 36 37 |
# File 'lib/evented_bluepill/dsl/process_proxy.rb', line 35 def to_process EventedBluepill::Process.new(@name, @watches, @attributes) end |