Class: Nacha::ParserContext
- Inherits:
-
Object
- Object
- Nacha::ParserContext
- Defined in:
- lib/nacha/parser_context.rb
Instance Attribute Summary collapse
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#line_errors ⇒ Object
Returns the value of attribute line_errors.
-
#line_length ⇒ Object
Returns the value of attribute line_length.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#parser_ended_at ⇒ Object
Returns the value of attribute parser_ended_at.
-
#parser_started_at ⇒ Object
Returns the value of attribute parser_started_at.
-
#previous_record ⇒ Object
Returns the value of attribute previous_record.
-
#validated ⇒ Object
readonly
Returns the value of attribute validated.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ ParserContext
constructor
A new instance of ParserContext.
- #valid? ⇒ Boolean
- #validated? ⇒ Boolean
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_name ⇒ Object
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_errors ⇒ Object
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_length ⇒ Object
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_number ⇒ Object
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_at ⇒ Object
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_at ⇒ Object
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_record ⇒ Object
Returns the value of attribute previous_record.
5 6 7 |
# File 'lib/nacha/parser_context.rb', line 5 def previous_record @previous_record end |
#validated ⇒ Object (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
25 26 27 |
# File 'lib/nacha/parser_context.rb', line 25 def valid? @valid ||= errors.empty? end |
#validated? ⇒ Boolean
21 22 23 |
# File 'lib/nacha/parser_context.rb', line 21 def validated? @validated ||= false end |