Class: AfdParser::ClockInOut
- Inherits:
-
RecordParser
- Object
- RecordParser
- AfdParser::ClockInOut
- Defined in:
- lib/afd_parser/clock_in_out.rb
Instance Attribute Summary collapse
-
#creation_time ⇒ Object
readonly
Returns the value of attribute creation_time.
-
#line_id ⇒ Object
readonly
Returns the value of attribute line_id.
-
#pis ⇒ Object
readonly
Returns the value of attribute pis.
-
#record_type_id ⇒ Object
readonly
Returns the value of attribute record_type_id.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #export ⇒ Object
-
#initialize(line) ⇒ ClockInOut
constructor
A new instance of ClockInOut.
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_time ⇒ Object
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_id ⇒ Object
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 |
#pis ⇒ Object
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_id ⇒ Object
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
.size ⇒ Object
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 |
#export ⇒ Object
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 |