Class: Kiba::Extend::Transforms::Cspace::Valuationcontrolrefnumber
- Inherits:
-
Object
- Object
- Kiba::Extend::Transforms::Cspace::Valuationcontrolrefnumber
- Defined in:
- lib/kiba/extend/transforms/cspace/valuationcontrolrefnumber.rb
Overview
Generates typical pattern of ValuationcontrolRefNumbers based on year in value date, where available. For each year, the procedure data is sorted by the full date value, and the reference number value is incremented.
The typical number pattern used is the location record pattern from the Valuation Control number autogenerator in the UI. The pattern is:
- VC (customizable via the
prefixparameter) - 4-digit year (for rows with no date, the value given for
nodatevalwill be inserted here) - . (
preincrementsegmentparam) - autoincrementing digit
ASSUMPTIONS OF THIS TRANSFORM
- You will have already reduced the output to one row per valuation control to be created in CollectionSpace
- You will have used DateValue::ForceDayPrecision or some other
method to create a field containing only blank values and valid
ISO 8601 dates to be mapped to the unstructured date
valuedatefield in CollectionSpace
SORTING, or, how the end digit gets incremented within a year
See IdGenerator::YearBasedIncrementing for sorting details.
Instance Method Summary collapse
-
#close ⇒ Object
-
#initialize(datefield:, prefix: "VC", nodateval: "0000", preincrementsegment: ".", target: :valuationcontrolrefnumber, sorter: nil) ⇒ Valuationcontrolrefnumber
constructor
A new instance of Valuationcontrolrefnumber.
-
#process(row) ⇒ Object
Constructor Details
#initialize(datefield:, prefix: "VC", nodateval: "0000", preincrementsegment: ".", target: :valuationcontrolrefnumber, sorter: nil) ⇒ Valuationcontrolrefnumber
Returns a new instance of Valuationcontrolrefnumber.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/kiba/extend/transforms/cspace/valuationcontrolrefnumber.rb', line 81 def initialize(datefield:, prefix: "VC", nodateval: "0000", preincrementsegment: ".", target: :valuationcontrolrefnumber, sorter: nil) @generator = IdGenerator::YearBasedIncrementing.new( datefield: datefield, prefix: prefix, nodateval: nodateval, preincrementsegment: preincrementsegment, target: target, sorter: sorter ) end |
Instance Method Details
#close ⇒ Object
101 102 103 104 |
# File 'lib/kiba/extend/transforms/cspace/valuationcontrolrefnumber.rb', line 101 def close generator.finalized_rows .each { |row| yield row } end |
#process(row) ⇒ Object
97 98 99 |
# File 'lib/kiba/extend/transforms/cspace/valuationcontrolrefnumber.rb', line 97 def process(row) generator.process(row) end |