Class: ETL::Parser::FixedWidthField
- Defined in:
- lib/etl/parser/fixed_width_parser.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#field_end ⇒ Object
readonly
Returns the value of attribute field_end.
-
#field_length ⇒ Object
readonly
Returns the value of attribute field_length.
-
#field_start ⇒ Object
readonly
Returns the value of attribute field_start.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, field_start, field_end = nil, field_length = nil) ⇒ FixedWidthField
constructor
Initialize the field.
Constructor Details
#initialize(name, field_start, field_end = nil, field_length = nil) ⇒ FixedWidthField
Initialize the field.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/etl/parser/fixed_width_parser.rb', line 50 def initialize(name, field_start, field_end=nil, field_length=nil) @name = name @field_start = field_start - 1 if field_end @field_end = field_end @field_length = @field_end - @field_start elsif field_length @field_length = field_length @field_end = @field_start + @field_length else raise DefinitionError, "Either field_end or field_length required" end end |
Instance Attribute Details
#field_end ⇒ Object (readonly)
Returns the value of attribute field_end.
48 49 50 |
# File 'lib/etl/parser/fixed_width_parser.rb', line 48 def field_end @field_end end |
#field_length ⇒ Object (readonly)
Returns the value of attribute field_length.
48 49 50 |
# File 'lib/etl/parser/fixed_width_parser.rb', line 48 def field_length @field_length end |
#field_start ⇒ Object (readonly)
Returns the value of attribute field_start.
48 49 50 |
# File 'lib/etl/parser/fixed_width_parser.rb', line 48 def field_start @field_start end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
48 49 50 |
# File 'lib/etl/parser/fixed_width_parser.rb', line 48 def name @name end |