Class: AfdParser::SetTime

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_timeObject

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_timeObject 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_idObject

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_idObject

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

.sizeObject



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

#exportObject



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