Class: Nacha::ParserContext

Inherits:
Object
  • Object
show all
Defined in:
lib/nacha/parser_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ ParserContext

Returns a new instance of ParserContext.



10
11
12
13
14
15
16
17
18
19
# File 'lib/nacha/parser_context.rb', line 10

def initialize(opts = {})
  @file_name = opts[:file_name] || ''
  @line_number = opts[:line_number] || 0
  @line_length = opts[:line_length] || 0
  @current_line_errors = []
  @parser_started_at = Time.now.utc
  @parser_ended_at = nil
  @previous_record = nil
  @validated = false
end

Instance Attribute Details

#file_nameObject

Returns the value of attribute file_name.



5
6
7
# File 'lib/nacha/parser_context.rb', line 5

def file_name
  @file_name
end

#line_errorsObject

Returns the value of attribute line_errors.



5
6
7
# File 'lib/nacha/parser_context.rb', line 5

def line_errors
  @line_errors
end

#line_lengthObject

Returns the value of attribute line_length.



5
6
7
# File 'lib/nacha/parser_context.rb', line 5

def line_length
  @line_length
end

#line_numberObject

Returns the value of attribute line_number.



5
6
7
# File 'lib/nacha/parser_context.rb', line 5

def line_number
  @line_number
end

#parser_ended_atObject

Returns the value of attribute parser_ended_at.



5
6
7
# File 'lib/nacha/parser_context.rb', line 5

def parser_ended_at
  @parser_ended_at
end

#parser_started_atObject

Returns the value of attribute parser_started_at.



5
6
7
# File 'lib/nacha/parser_context.rb', line 5

def parser_started_at
  @parser_started_at
end

#previous_recordObject

Returns the value of attribute previous_record.



5
6
7
# File 'lib/nacha/parser_context.rb', line 5

def previous_record
  @previous_record
end

#validatedObject (readonly)

Returns the value of attribute validated.



8
9
10
# File 'lib/nacha/parser_context.rb', line 8

def validated
  @validated
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/nacha/parser_context.rb', line 25

def valid?
  @valid ||= errors.empty?
end

#validated?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/nacha/parser_context.rb', line 21

def validated?
  @validated ||= false
end