Module: Onoma
- Defined in:
- lib/onoma.rb,
lib/onoma/item.rb,
lib/onoma/version.rb,
lib/onoma/database.rb,
lib/onoma/property.rb,
lib/onoma/relation.rb,
lib/onoma/migration.rb,
lib/onoma/reference.rb,
lib/onoma/reflection.rb,
lib/onoma/nomenclature.rb,
lib/onoma/migration/actions/base.rb,
lib/onoma/migration/actions/item_change.rb,
lib/onoma/migration/actions/item_merging.rb,
lib/onoma/migration/actions/item_removal.rb,
lib/onoma/migration/actions/item_creation.rb,
lib/onoma/migration/actions/property_creation.rb,
lib/onoma/migration/actions/nomenclature_change.rb,
lib/onoma/migration/actions/nomenclature_removal.rb,
lib/onoma/migration/actions/nomenclature_creation.rb
Defined Under Namespace
Classes: Database, InvalidProperty, Item, Migration, Migrator, MissingChoices, MissingNomenclature, Nomenclature, Property, Reference, Reflection, Relation
Constant Summary
collapse
- XMLNS =
'http://www.ekylibre.org/XML/2013/nomenclatures'.freeze
- NS_SEPARATOR =
'-'.freeze
- PROPERTY_TYPES =
%i[boolean item item_list choice choice_list string_list date decimal integer nomenclature string symbol].freeze
- VERSION =
'0.3.1'.freeze
Class Method Summary
collapse
Class Method Details
.connection ⇒ Object
46
47
48
49
|
# File 'lib/onoma.rb', line 46
def connection
load_database unless database_loaded?
@@set
end
|
.database_path ⇒ Object
34
35
36
|
# File 'lib/onoma.rb', line 34
def database_path
root.join('db')
end
|
.each(&block) ⇒ Object
73
74
75
|
# File 'lib/onoma.rb', line 73
def each(&block)
set.each(&block)
end
|
.find(*args) ⇒ Object
Give access to named nomenclatures
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/onoma.rb', line 61
def find(*args)
args.
name = args.shift
if args.empty?
return set[name]
elsif args.size == 1
return set[name].find(args.shift) if set[name]
end
nil
end
|
.load_locales ⇒ Object
81
82
83
|
# File 'lib/onoma.rb', line 81
def load_locales
I18n.load_path.concat(Dir.glob(root.join('config', 'locales', '**', '*.yml')))
end
|
.migrations_path ⇒ Object
38
39
40
|
# File 'lib/onoma.rb', line 38
def migrations_path
database_path.join('migrate')
end
|
.names ⇒ Object
Returns the names of the nomenclatures
52
53
54
|
# File 'lib/onoma.rb', line 52
def names
set.nomenclature_names
end
|
.reference_path ⇒ Object
42
43
44
|
# File 'lib/onoma.rb', line 42
def reference_path
database_path.join('reference.xml')
end
|
.root ⇒ Object
30
31
32
|
# File 'lib/onoma.rb', line 30
def root
Pathname.new(__FILE__).dirname.dirname
end
|
.set ⇒ Object
77
78
79
|
# File 'lib/onoma.rb', line 77
def set
@@set ||= Database.open(reference_path)
end
|