class Smith::Commands::Push::FileReader
Public Class Methods
new(file)
click to toggle source
# File lib/smith/commands/smithctl/push.rb, line 106 def initialize(file) @file = (file.is_a?(IO)) ? file : File.open(file) end
Public Instance Methods
each(on_work, on_completed)
click to toggle source
# File lib/smith/commands/smithctl/push.rb, line 110 def each(on_work, on_completed) on_done = proc do |message| line = @file.readline rescue nil if line class << on_done; alias :next :call; end on_work.call(line, on_done) else on_completed.call end end EM.next_tick(&on_done) end