Module: OLE_QA::Framework::Metadata_Factory
- Extended by:
- Factory_Helpers
- Defined in:
- lib/data_factory/metadata_factory.rb
Overview
This class contains methods to generate assorted metadata for the OLE application.
{OLE_QA::Framework::Bib_Factory} should be used for creating bibliographic metadata.
Class Method Summary collapse
-
.location_code ⇒ Object
(also: new_location_code)
Generate a usable OLE location code.
-
.new_location(level = 1, parent = '') ⇒ Object
Create a new location as a hash.
Class Method Details
.location_code ⇒ Object Also known as: new_location_code
Generate a usable OLE location code.
23 24 25 26 27 28 29 |
# 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 |
.new_location(level = 1, parent = '') ⇒ Object
Create a new location as a hash.
35 36 37 38 39 40 41 42 43 |
# 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 |