Class: Chitin::PVC
- Includes:
- Runnable
- Defined in:
- lib/chitin/commands/ruby.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#chains ⇒ Object
readonly
Returns the value of attribute chains.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
Instance Method Summary collapse
-
#initialize(*arr, &block) ⇒ PVC
constructor
A new instance of PVC.
- #method_missing(*arr, &block) ⇒ Object
Methods included from Runnable
#<, #>, #>>, #[], #^, #bg!, #bg?, #fg?, #|
Constructor Details
#initialize(*arr, &block) ⇒ PVC
Returns a new instance of PVC.
10 11 12 13 14 15 16 17 18 |
# File 'lib/chitin/commands/ruby.rb', line 10 def initialize(*arr, &block) super() raise "Need at least a method name" unless [String, Symbol].include? arr.first.class @chains = [] latest = [*arr] latest << block if block @chains << latest end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*arr, &block) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/chitin/commands/ruby.rb', line 20 def method_missing(*arr, &block) latest = [*arr] latest << block if block @chains << latest self # chainable end |