Class: Chitin::PVC

Inherits:
Object show all
Includes:
Runnable
Defined in:
lib/chitin/commands/ruby.rb

Direct Known Subclasses

StringMethod

Instance Attribute Summary collapse

Instance Method Summary collapse

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

Instance Attribute Details

#chainsObject (readonly)

Returns the value of attribute chains.



7
8
9
# File 'lib/chitin/commands/ruby.rb', line 7

def chains
  @chains
end

#pidObject (readonly)

Returns the value of attribute pid.



8
9
10
# File 'lib/chitin/commands/ruby.rb', line 8

def pid
  @pid
end