Class Tap::Signals::Load
In: lib/tap/signals/load.rb
Parent: Signal

Methods

call   each_signal   process  

Included Modules

Utils

Public Instance methods

[Source]

    # File lib/tap/signals/load.rb, line 8
 8:       def call(args)
 9:         args.each {|path| process(path) }
10:         obj
11:       end

[Source]

    # File lib/tap/signals/load.rb, line 25
25:       def each_signal(io)
26:         offset = -1 * ($/.length + 1)
27: 
28:         carryover = nil
29:         io.each_line do |line|
30:           if line[offset] == ?\\
31:             carryover ||= []
32:             carryover << line[0, line.length + offset]
33:             carryover << $/
34:             next
35:           end
36: 
37:           if carryover
38:             carryover << line
39:             line = carryover.join
40:             carryover = nil
41:           end
42: 
43:           sig, *args = shellsplit(line)
44:           yield(sig, args) if sig
45:         end
46:       end

[Source]

    # File lib/tap/signals/load.rb, line 13
13:       def process(path)
14:         if File.exists?(path)
15:           File.open(path) do |io|
16:             each_signal(io) do |sig, args|
17:               obj.signal(sig).call(args)
18:             end
19:           end
20:         end
21:         
22:         obj
23:       end

[Validate]