Class: AfdParser::ClockInOut

Inherits:
RecordParser show all
Defined in:
lib/afd_parser/clock_in_out.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ ClockInOut

Returns a new instance of ClockInOut.



26
27
28
29
# File 'lib/afd_parser/clock_in_out.rb', line 26

def initialize(line)
  self.line_id, self.record_type_id, self.creation_time, self.pis =
    line.unpack("A9AA12A12").collect{|str| _clean!(str)}
end

Instance Attribute Details

#creation_timeObject

Returns the value of attribute creation_time.



24
25
26
# File 'lib/afd_parser/clock_in_out.rb', line 24

def creation_time
  @creation_time
end

#line_idObject

Returns the value of attribute line_id.



24
25
26
# File 'lib/afd_parser/clock_in_out.rb', line 24

def line_id
  @line_id
end

#pisObject

Returns the value of attribute pis.



24
25
26
# File 'lib/afd_parser/clock_in_out.rb', line 24

def pis
  @pis
end

#record_type_idObject

Returns the value of attribute record_type_id.



24
25
26
# File 'lib/afd_parser/clock_in_out.rb', line 24

def record_type_id
  @record_type_id
end

Class Method Details

.sizeObject



40
41
42
# File 'lib/afd_parser/clock_in_out.rb', line 40

def self.size
  34
end

Instance Method Details

#==(other) ⇒ Object



44
45
46
47
48
# File 'lib/afd_parser/clock_in_out.rb', line 44

def ==(other)
  return self.class == other.class && [:line_id, :record_type_id, :creation_time, :pis].all? do |reader|
    self.send(reader) == other.send(reader)
  end
end

#exportObject



31
32
33
34
35
36
37
38
# File 'lib/afd_parser/clock_in_out.rb', line 31

def export
  line_export = ""
  line_export += line_id.to_s.rjust(9,"0")
  line_export += record_type_id.to_s
  line_export += format_time(creation_time)
  line_export += pis.to_s.rjust(11,"0")
  line_export
end