lib/scaffolder/region/sequence.rb in scaffolder-0.4.1 vs lib/scaffolder/region/sequence.rb in scaffolder-0.4.2
- old
+ new
@@ -40,21 +40,25 @@
end
end
end
end
-# attribute :inserts, :default => Array.new
-
# Adds each of the sequence inserts to the raw sequence. Updates the sequence
# length each time an insert is added to reflect the change.
#
# @return [String] original sequence with inserts added.
# @raise [CoordinateError] if any insert open position is greater than the
# length of the original sequence
# @raise [CoordinateError] if any insert close position is less than one
# @raise [CoordinateError] if any insert open position is greater than the
# close position
def sequence_hook
+ @updated_sequence ||= update_sequence_with_inserts
+ end
+
+ private
+
+ def update_sequence_with_inserts
# Set the sequence stop positon if not defined as the stop
# position is updated as each insert is added
@stop ||= raw_sequence.length
return inserts.sort.reverse.inject(raw_sequence) do |seq,insert|