Class: Billing::Field

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/billing/field.rb

Overview

represents a field in a row in BIF file

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#constant_valueObject

Returns the value of attribute constant_value


5
6
7
# File 'app/models/billing/field.rb', line 5

def constant_value
  @constant_value
end

#dynamic_attributeObject

Returns the value of attribute dynamic_attribute


5
6
7
# File 'app/models/billing/field.rb', line 5

def dynamic_attribute
  @dynamic_attribute
end

#nameObject

Returns the value of attribute name


5
6
7
# File 'app/models/billing/field.rb', line 5

def name
  @name
end

#number_of_spacesObject

Returns the value of attribute number_of_spaces


5
6
7
# File 'app/models/billing/field.rb', line 5

def number_of_spaces
  @number_of_spaces
end

#orderObject

Returns the value of attribute order


5
6
7
# File 'app/models/billing/field.rb', line 5

def order
  @order
end

#position_fromObject

Returns the value of attribute position_from


5
6
7
# File 'app/models/billing/field.rb', line 5

def position_from
  @position_from
end

#position_toObject

Returns the value of attribute position_to


5
6
7
# File 'app/models/billing/field.rb', line 5

def position_to
  @position_to
end

#right_justifiedObject

Returns the value of attribute right_justified


5
6
7
# File 'app/models/billing/field.rb', line 5

def right_justified
  @right_justified
end

Instance Method Details

#alignmentObject


13
14
15
# File 'app/models/billing/field.rb', line 13

def alignment
  right_justified ? :rjust : :ljust
end

#lengthObject


9
10
11
# File 'app/models/billing/field.rb', line 9

def length
  position_to - position_from + 1
end

#value(billing_item = nil) ⇒ Object


17
18
19
# File 'app/models/billing/field.rb', line 17

def value(billing_item = nil)
  constant_value || billing_item.send(dynamic_attribute)
end