Class: AfdParser::SetEmployee
- Inherits:
-
RecordParser
- Object
- RecordParser
- AfdParser::SetEmployee
- Defined in:
- lib/afd_parser/set_employee.rb
Constant Summary collapse
- OPERATION_TYPE =
{"I" => :add, "A" => :edit, "E" => :remove}
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.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#operation_type ⇒ Object
readonly
Returns the value of attribute operation_type.
-
#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) ⇒ SetEmployee
constructor
A new instance of SetEmployee.
Constructor Details
#initialize(line) ⇒ SetEmployee
Returns a new instance of SetEmployee.
29 30 31 32 33 34 |
# File 'lib/afd_parser/set_employee.rb', line 29 def initialize(line) self.line_id, self.record_type_id, self.creation_time, self.operation_type = line.unpack("A9AA12A").collect{|str| _clean!(str)} self.pis, self.name = line[23..-1].match(/\A(\d{1,12})(.{1,52})/)[1..2].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/set_employee.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/set_employee.rb', line 24 def line_id @line_id end |
#name ⇒ Object
Returns the value of attribute name.
24 25 26 |
# File 'lib/afd_parser/set_employee.rb', line 24 def name @name end |
#operation_type ⇒ Object
Returns the value of attribute operation_type.
24 25 26 |
# File 'lib/afd_parser/set_employee.rb', line 24 def operation_type @operation_type end |
#pis ⇒ Object
Returns the value of attribute pis.
24 25 26 |
# File 'lib/afd_parser/set_employee.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/set_employee.rb', line 24 def record_type_id @record_type_id end |
Class Method Details
.size ⇒ Object
47 48 49 |
# File 'lib/afd_parser/set_employee.rb', line 47 def self.size 87 end |
Instance Method Details
#==(other) ⇒ Object
51 52 53 54 55 |
# File 'lib/afd_parser/set_employee.rb', line 51 def ==(other) return self.class == other.class && [:line_id, :record_type_id, :creation_time, :operation_type, :pis, :name].all? do |reader| self.send(reader) == other.send(reader) end end |
#export ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/afd_parser/set_employee.rb', line 36 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 += get_operation_letter(@operation_type).to_s line_export += @pis.to_s.rjust(12,"0") line_export += @name.ljust(52, " ") line_export end |