class Omloga::Request
Attributes
complete_count[RW]
count[RW]
created_at[RW]
id[RW]
lines[RW]
path[RW]
pid[RW]
saved[RW]
status[RW]
updated_at[RW]
uuid[RW]
Public Class Methods
new(uuid, pid, start_line)
click to toggle source
# File lib/omloga/request.rb, line 9 def initialize(uuid, pid, start_line) @id = BSON::ObjectId.new @uuid = uuid @pid = pid @saved = false @count = 1 @complete_count = 0 @status = [] @path = [] @lines = [] add_start_line(start_line.to_s) end
Public Instance Methods
add_end_line(line)
click to toggle source
# File lib/omloga/request.rb, line 27 def add_end_line(line) self.lines << line self.status << line.match(/Completed ([2-5][0-9][0-9]) /)[1].to_i end
add_line_special(line, pos)
click to toggle source
# File lib/omloga/request.rb, line 55 def add_line_special(line, pos) line = line.to_s lines.insert(line, pos.to_i) rescue StandardError => e puts "\nline = \n#{line} | is_last = #{is_last}" puts e.message puts e.backtrace.join("\n") exit end
add_start_line(line)
click to toggle source
# File lib/omloga/request.rb, line 22 def add_start_line(line) self.lines << line self.path << line.match(/Started [A-Z]+ "(.+)"/)[1] end
id_doc()
click to toggle source
# File lib/omloga/request.rb, line 51 def id_doc {'_id' => id } end
mongo_doc()
click to toggle source
# File lib/omloga/request.rb, line 32 def mongo_doc obj = { '_id' => id, 'uuid' => uuid, 'pid' => pid, 'count' => count, 'path' => path, 'status' => status, 'lines' => lines } if saved obj['updated_at'] = Time.now else obj['created_at'] = obj['updated_at'] = Time.now end obj end