Class: BankPayments::SwedbankExport::FieldDefinition
- Inherits:
-
Object
- Object
- BankPayments::SwedbankExport::FieldDefinition
- Defined in:
- lib/bank_payments/swedbank_export/field_definition.rb
Overview
Defines a field in the the Swedbank SPISU format
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#stop ⇒ Object
readonly
Returns the value of attribute stop.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, definition) ⇒ FieldDefinition
constructor
A new instance of FieldDefinition.
- #length ⇒ Object
Constructor Details
#initialize(name, definition) ⇒ FieldDefinition
Returns a new instance of FieldDefinition.
9 10 11 12 13 14 15 |
# File 'lib/bank_payments/swedbank_export/field_definition.rb', line 9 def initialize(name, definition) @name = name unformatted_def = definition.split(':') @start, @stop, @type = unformatted_def.each_with_index.map do |value,idx| idx < 2 ? value.to_i : value end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/bank_payments/swedbank_export/field_definition.rb', line 7 def name @name end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
7 8 9 |
# File 'lib/bank_payments/swedbank_export/field_definition.rb', line 7 def start @start end |
#stop ⇒ Object (readonly)
Returns the value of attribute stop.
7 8 9 |
# File 'lib/bank_payments/swedbank_export/field_definition.rb', line 7 def stop @stop end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/bank_payments/swedbank_export/field_definition.rb', line 7 def type @type end |
Instance Method Details
#length ⇒ Object
17 18 19 |
# File 'lib/bank_payments/swedbank_export/field_definition.rb', line 17 def length @stop - @start + 1 end |