module OLE_QA::Framework::Metadata_Factory

This class contains methods to generate assorted metadata for the OLE application.

{OLE_QA::Framework::Bib_Factory} should be used for creating bibliographic metadata.

Public Class Methods

location_code() click to toggle source

Generate a usable OLE location code.

# File lib/data_factory/metadata_factory.rb, line 23
def location_code
  str_out = String.new
  str_out << sampler('A'..'Z')
  str_out << sampler('0'..'9')
  str_out << str(sampler(2..4))
  str_out.upcase
end
Also aliased as: new_location_code
new_location(level = 1, parent = '') click to toggle source

Create a new location as a hash. @param [String] level Set the location’s level. (Optional, defaults to 1.) @param [String] parent The parent location code. (Optional, defaults to none.)

# File lib/data_factory/metadata_factory.rb, line 35
def new_location(level = 1, parent = '')
  hash                    = Hash.new
  hash[:code]             = location_code
  hash[:name]             = name_builder(sampler(6..8))
  hash[:description]      = name_builder(sampler(8..12))
  hash[:level]            = level.to_s
  hash[:parent]           = parent unless parent.empty?
  hash
end
new_location_code()
Alias for: location_code