Class: AfdParser::SetEmployer
- Inherits:
-
RecordParser
- Object
- RecordParser
- AfdParser::SetEmployer
- Defined in:
- lib/afd_parser/set_employer.rb
Constant Summary collapse
- DOCUMENT_TYPES =
{1 => :cnpj, 2 => :cpf}
Instance Attribute Summary collapse
-
#cei ⇒ Object
readonly
Returns the value of attribute cei.
-
#creation_time ⇒ Object
readonly
Returns the value of attribute creation_time.
-
#document_number ⇒ Object
readonly
Returns the value of attribute document_number.
-
#document_type ⇒ Object
readonly
Returns the value of attribute document_type.
-
#line_id ⇒ Object
readonly
Returns the value of attribute line_id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#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) ⇒ SetEmployer
constructor
A new instance of SetEmployer.
Constructor Details
#initialize(line) ⇒ SetEmployer
Returns a new instance of SetEmployer.
29 30 31 32 33 34 35 |
# File 'lib/afd_parser/set_employer.rb', line 29 def initialize(line) self.line_id, self.record_type_id, self.creation_time, self.document_type, self.document_number, self.cei, self.name, self.location = line.unpack("A9AA12AA14A12A150A100").collect do |str| _clean!(str) end end |
Instance Attribute Details
#cei ⇒ Object
Returns the value of attribute cei.
24 25 26 |
# File 'lib/afd_parser/set_employer.rb', line 24 def cei @cei end |
#creation_time ⇒ Object
Returns the value of attribute creation_time.
24 25 26 |
# File 'lib/afd_parser/set_employer.rb', line 24 def creation_time @creation_time end |
#document_number ⇒ Object
Returns the value of attribute document_number.
24 25 26 |
# File 'lib/afd_parser/set_employer.rb', line 24 def document_number @document_number end |
#document_type ⇒ Object
Returns the value of attribute document_type.
24 25 26 |
# File 'lib/afd_parser/set_employer.rb', line 24 def document_type @document_type end |
#line_id ⇒ Object
Returns the value of attribute line_id.
24 25 26 |
# File 'lib/afd_parser/set_employer.rb', line 24 def line_id @line_id end |
#location ⇒ Object
Returns the value of attribute location.
24 25 26 |
# File 'lib/afd_parser/set_employer.rb', line 24 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
24 25 26 |
# File 'lib/afd_parser/set_employer.rb', line 24 def name @name end |
#record_type_id ⇒ Object
Returns the value of attribute record_type_id.
24 25 26 |
# File 'lib/afd_parser/set_employer.rb', line 24 def record_type_id @record_type_id end |
Class Method Details
.size ⇒ Object
50 51 52 |
# File 'lib/afd_parser/set_employer.rb', line 50 def self.size 299 end |
Instance Method Details
#==(other) ⇒ Object
54 55 56 57 58 |
# File 'lib/afd_parser/set_employer.rb', line 54 def ==(other) return self.class == other.class && [:line_id, :record_type_id, :creation_time, :document_type, :document_number, :cei, :name, :location].all? do |reader| self.send(reader) == other.send(reader) end end |
#export ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/afd_parser/set_employer.rb', line 37 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_document_type_number(@document_type).to_s line_export += @document_number.to_s.rjust(14, "0") line_export += @cei.to_s.rjust(12, "0") line_export += @name.ljust(150, " ") line_export += @location.ljust(100, " ") line_export end |