module Onoma
rubocop:disable Style/MissingRespondToMissing
Constants
- NS_SEPARATOR
- PROPERTY_TYPES
- VERSION
- XMLNS
Public Class Methods
Source
# File lib/onoma.rb, line 106 def [](index) set[index] end
Give access to named nomenclatures delegate :[], to: :set
Source
# File lib/onoma.rb, line 134 def each(&block) set.each(&block) end
Browse all nomenclatures
Source
# File lib/onoma.rb, line 42 def escape_key(key) key.to_s.gsub('.', '-').to_sym end
Source
# File lib/onoma.rb, line 111 def find(*args) args.extract_options! name = args.shift nomenclature = find_or_initialize(name) if args.empty? return nomenclature elsif args.size == 1 return nomenclature.find(args.shift) if nomenclature end nil end
Give access to named nomenclatures
Source
# File lib/onoma.rb, line 124 def find_or_initialize(name) set[name] || set.load_data_from_xml(name) end
Source
# File lib/onoma.rb, line 129 def load! @@set = NomenclatureSet.load_file(reference_path) end
Force loading of nomenclatures
Source
# File lib/onoma.rb, line 142 def load_locales I18n.load_path.concat(Dir.glob(Onoma.root.join('config', 'locales', '*.yml'))) end
Source
# File lib/onoma.rb, line 81 def migrations Dir.glob(migrations_path.join('*.xml')).sort.collect do |f| Onoma::Migration::Base.parse(Pathname.new(f)) end end
Returns list of Onoma::Migration
Source
# File lib/onoma.rb, line 54 def migrations_path database_path.join('migrate') end
Source
# File lib/onoma.rb, line 88 def missing_migrations last_version = reference_version migrations.select do |m| m.number > last_version end end
Returns list of migrations since last done
Source
# File lib/onoma.rb, line 96 def names set.nomenclature_names end
Returns the names of the nomenclatures
Source
# File lib/onoma.rb, line 69 def reference_document unless @document f = File.open(reference_path, 'rb') @document = Nokogiri::XML(f) do |config| config.strict.nonet.noblanks.noent end f.close end @document end
Source
# File lib/onoma.rb, line 58 def reference_path database_path.join('reference.xml') end
Source
# File lib/onoma.rb, line 63 def reference_version return 0 unless reference_path.exist? reference_document.root['version'].to_i end
Returns version of DB