Class: AfdParser::SetTime
- Inherits:
-
RecordParser
- Object
- RecordParser
- AfdParser::SetTime
- Defined in:
- lib/afd_parser/set_time.rb
Instance Attribute Summary collapse
-
#after_time ⇒ Object
readonly
Returns the value of attribute after_time.
-
#before_time ⇒ Object
(also: #creation_time)
readonly
Returns the value of attribute before_time.
-
#line_id ⇒ Object
readonly
Returns the value of attribute line_id.
-
#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) ⇒ SetTime
constructor
A new instance of SetTime.
Constructor Details
#initialize(line) ⇒ SetTime
Returns a new instance of SetTime.
27 28 29 30 |
# File 'lib/afd_parser/set_time.rb', line 27 def initialize(line) self.line_id, self.record_type_id, self.before_time, self.after_time = line.unpack("A9AA12A12").collect{|str| _clean!(str)} end |
Instance Attribute Details
#after_time ⇒ Object
Returns the value of attribute after_time.
24 25 26 |
# File 'lib/afd_parser/set_time.rb', line 24 def after_time @after_time end |
#before_time ⇒ Object Also known as: creation_time
Returns the value of attribute before_time.
24 25 26 |
# File 'lib/afd_parser/set_time.rb', line 24 def before_time @before_time end |
#line_id ⇒ Object
Returns the value of attribute line_id.
24 25 26 |
# File 'lib/afd_parser/set_time.rb', line 24 def line_id @line_id end |
#record_type_id ⇒ Object
Returns the value of attribute record_type_id.
24 25 26 |
# File 'lib/afd_parser/set_time.rb', line 24 def record_type_id @record_type_id end |
Class Method Details
.size ⇒ Object
41 42 43 |
# File 'lib/afd_parser/set_time.rb', line 41 def self.size 34 end |
Instance Method Details
#==(other) ⇒ Object
45 46 47 48 49 |
# File 'lib/afd_parser/set_time.rb', line 45 def ==(other) return self.class == other.class && [:line_id, :record_type_id, :before_time, :after_time].all? do |reader| self.send(reader) == other.send(reader) end end |
#export ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/afd_parser/set_time.rb', line 32 def export line_export = "" line_export += @line_id.to_s.rjust(9,"0") line_export += @record_type_id.to_s line_export += format_time(@before_time) line_export += format_time(@after_time) line_export end |