Skip to content

Commit

Permalink
placeholder for #292
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaj committed Jul 13, 2016
1 parent 2061ffd commit dabe19d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions app/models/minter_state.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class MinterState < ActiveRecord::Base
validates :namespace, presence: true, uniqueness: true
validates :template, presence: true
validates :template, format: { with: Object.const_get('Noid::Template::VALID_PATTERN'), message: 'value fails regex' }

# @return [Hash] options for Noid::Minter.new
# * template [String] setting the identifier pattern
# * seq [Integer] reflecting minter position in sequence
# * counters [Array{Hash}] "buckets" each with :current and :max values
# * rand [Object] random number generator object
def noid_options
Rails.logger.debug("
app/model/minter_state.rb is a placeholder for active_fedora-noid-2.0.0.beta1/app/models/minter_state.rb
See: https://github.com/projecthydra-labs/active_fedora-noid/issues/29
Once active_fedora-noid-2.0.0 is out of beta, and CurationConcerns no longer requires it,
remove this file.
")
return nil unless template
opts = {
:template => template,
:seq => seq
}
opts[:counters] = JSON.parse(counters, :symbolize_names => true) if counters
opts[:rand] = Marshal.load(random) if random
opts
end
end

0 comments on commit dabe19d

Please sign in to comment.