Class: QuickETL::QifDate

Inherits:
QuickETLObject show all
Defined in:
lib/quick_etl_qif_date.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from QuickETLKernel

#command_line_arg, #command_line_array_arg, #command_line_boolean_arg, #default_delimiter, #display_general_info, #display_usage_instructions, #get_array_property, #get_property, #home_dir, #line_value, #load_properties, #parse_qif_files, #project_author, #project_copyright, #project_date, #project_embedded_comment, #project_license, #project_name, #project_version_number, #project_year, #read_as_ascii_lines, #read_lines, #startup, #strip_lines, #tokenize, #usage_instructions, #write_file, #write_lines

Constructor Details

#initialize(raw_line) ⇒ QifDate

Returns a new instance of QifDate.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/quick_etl_qif_date.rb', line 20

def initialize(raw_line)
  @raw_line = raw_line
  @y, @m, @d  =  0, 0, 0
  @cc, @yy, @mm, @dd = '00', '00', '00', '00'
  
  if @raw_line
    tokens = @raw_line.split('/')
    if (tokens && tokens.size > 2)
      m   = tokens[0].to_i
      d   = tokens[1].to_i
      y   = tokens[2].to_i
      @yy = tokens[2]
      y < 50 ? @cc = "20" : @cc = "19"
      m < 10 ? @mm = "0#{m}" : @mm = "#{m}"
      d < 10 ? @dd = "0#{d}" : @dd = "#{d}"
    end
  end
  @ccyymmdd = "#{@cc}#{@yy}-#{@mm}-#{@dd}"
  @year     = "#{@cc}#{@yy}"
  @year_mm  = "#{@cc}#{@yy}-#{@mm}"
end

Instance Attribute Details

#ccyymmddObject

Returns the value of attribute ccyymmdd.



18
19
20
# File 'lib/quick_etl_qif_date.rb', line 18

def ccyymmdd
  @ccyymmdd
end

#ddObject

Returns the value of attribute dd.



18
19
20
# File 'lib/quick_etl_qif_date.rb', line 18

def dd
  @dd
end

#mmObject

Returns the value of attribute mm.



18
19
20
# File 'lib/quick_etl_qif_date.rb', line 18

def mm
  @mm
end

#raw_lineObject

Returns the value of attribute raw_line.



18
19
20
# File 'lib/quick_etl_qif_date.rb', line 18

def raw_line
  @raw_line
end

#yearObject

Returns the value of attribute year.



18
19
20
# File 'lib/quick_etl_qif_date.rb', line 18

def year
  @year
end

#year_mmObject

Returns the value of attribute year_mm.



18
19
20
# File 'lib/quick_etl_qif_date.rb', line 18

def year_mm
  @year_mm
end

#yyObject

Returns the value of attribute yy.



18
19
20
# File 'lib/quick_etl_qif_date.rb', line 18

def yy
  @yy
end