Class: UkAccountValidator::ModulusWeight
- Inherits:
-
Object
- Object
- UkAccountValidator::ModulusWeight
- Defined in:
- lib/uk_account_validator/modulus_weight.rb
Constant Summary collapse
- COLUMN_SIZES =
the size of each column
[6, 7, 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 3]
Instance Attribute Summary collapse
-
#a ⇒ Object
readonly
Returns the value of attribute a.
-
#b ⇒ Object
readonly
Returns the value of attribute b.
-
#c ⇒ Object
readonly
Returns the value of attribute c.
-
#d ⇒ Object
readonly
Returns the value of attribute d.
-
#e ⇒ Object
readonly
Returns the value of attribute e.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#f ⇒ Object
readonly
Returns the value of attribute f.
-
#g ⇒ Object
readonly
Returns the value of attribute g.
-
#h ⇒ Object
readonly
Returns the value of attribute h.
-
#modulus ⇒ Object
readonly
Returns the value of attribute modulus.
-
#sort_code_end ⇒ Object
readonly
Returns the value of attribute sort_code_end.
-
#sort_code_start ⇒ Object
readonly
Returns the value of attribute sort_code_start.
-
#u ⇒ Object
readonly
Returns the value of attribute u.
-
#v ⇒ Object
readonly
Returns the value of attribute v.
-
#w ⇒ Object
readonly
Returns the value of attribute w.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
-
#z ⇒ Object
readonly
Returns the value of attribute z.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(sort_code_start, sort_code_end, modulus, u, v, w, x, y, z, a, b, c, d, e, f, g, h, exception) ⇒ ModulusWeight
constructor
A new instance of ModulusWeight.
Constructor Details
#initialize(sort_code_start, sort_code_end, modulus, u, v, w, x, y, z, a, b, c, d, e, f, g, h, exception) ⇒ ModulusWeight
Returns a new instance of ModulusWeight.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 22 def initialize(sort_code_start, sort_code_end, modulus, u, v, w, x, y, z, a, b, c, d, e, f, g, h, exception) @sort_code_start = sort_code_start @sort_code_end = sort_code_end @modulus = modulus @exception = exception @u, @v, @w, @x, @y, @z, @a, @b, @c, @d, @e, @f, @g, @h = [u.to_i, v.to_i, w.to_i, x.to_i, y.to_i, z.to_i, a.to_i, b.to_i, c.to_i, d.to_i, e.to_i, f.to_i, g.to_i, h.to_i] end |
Instance Attribute Details
#a ⇒ Object (readonly)
Returns the value of attribute a.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def a @a end |
#b ⇒ Object (readonly)
Returns the value of attribute b.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def b @b end |
#c ⇒ Object (readonly)
Returns the value of attribute c.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def c @c end |
#d ⇒ Object (readonly)
Returns the value of attribute d.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def d @d end |
#e ⇒ Object (readonly)
Returns the value of attribute e.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def e @e end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def exception @exception end |
#f ⇒ Object (readonly)
Returns the value of attribute f.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def f @f end |
#g ⇒ Object (readonly)
Returns the value of attribute g.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def g @g end |
#h ⇒ Object (readonly)
Returns the value of attribute h.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def h @h end |
#modulus ⇒ Object (readonly)
Returns the value of attribute modulus.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def modulus @modulus end |
#sort_code_end ⇒ Object (readonly)
Returns the value of attribute sort_code_end.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def sort_code_end @sort_code_end end |
#sort_code_start ⇒ Object (readonly)
Returns the value of attribute sort_code_start.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def sort_code_start @sort_code_start end |
#u ⇒ Object (readonly)
Returns the value of attribute u.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def u @u end |
#v ⇒ Object (readonly)
Returns the value of attribute v.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def v @v end |
#w ⇒ Object (readonly)
Returns the value of attribute w.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def w @w end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def y @y end |
#z ⇒ Object (readonly)
Returns the value of attribute z.
3 4 5 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 3 def z @z end |
Class Method Details
.from_line(definition_line) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/uk_account_validator/modulus_weight.rb', line 10 def self.from_line(definition_line) # See https://www.ruby-forum.com/topic/184294#805359 data = definition_line.unpack("A#{COLUMN_SIZES.join('A')}") data.map!(&:strip) @sort_code_start, @sort_code_end, @modulus, @u, @v, @w, @x, @y, @z, @a, @b, @c, @d, @e, @f, @g, @h, @exception = data ModulusWeight.new(*data) end |