add_symbolic_names 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 057d884b4279bf5ca4347381f2396e5e4a16f218
|
4
|
+
data.tar.gz: ae26b419847a2ff35c0d567d410358749a85557e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5483d4b9897dec2cdc9f8923e8c2dae31fd3334082cbed0021b2c3084fc2653be2f55e8a711e963834009e1c8e1040828b74d9cc88330e84255737c12fd6fa68
|
7
|
+
data.tar.gz: dcbab90d061bdf7f6185d56e077efb1e5286441d4dc0f5c754c82abc4bfbbc8992bc68c4ad17fd8f3a06c76ae245342e745bf208e4afa7dd5e61f4f0085a7e27
|
@@ -2,9 +2,13 @@ module AddSymbolicNames
|
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
3
|
config.add_symbolic_names = ActiveSupport::OrderedOptions.new
|
4
4
|
config.add_symbolic_names.default_store = nil
|
5
|
+
config.add_symbolic_names.yaml_folder = nil
|
5
6
|
|
6
7
|
initializer 'add_symbolic_names' do |app|
|
7
8
|
AddSymbolicNames.default_store = app.config.add_symbolic_names.default_store if app.config.add_symbolic_names.default_store
|
9
|
+
AddSymbolicNames::Store::Yaml.folder = app.config.add_symbolic_names.yaml_folder ||
|
10
|
+
File.join(config.root, "db/domain")
|
11
|
+
|
8
12
|
ActiveSupport.on_load(:active_record) do
|
9
13
|
include AddSymbolicNames::Mixin
|
10
14
|
end
|
@@ -3,8 +3,10 @@ require 'yaml'
|
|
3
3
|
module AddSymbolicNames
|
4
4
|
module Store
|
5
5
|
class Yaml
|
6
|
+
mattr_accessor :folder
|
7
|
+
|
6
8
|
def self.define_constants(klass, opts)
|
7
|
-
YAML.load_file(File.join(
|
9
|
+
YAML.load_file(File.join(self.folder, "#{klass.name.demodulize.tableize}.yml")).each do |datum|
|
8
10
|
klass.const_set(datum['symbolic_name'], datum['id']) unless klass.const_defined?(datum['symbolic_name'])
|
9
11
|
end
|
10
12
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module AddSymbolicNames
|
2
|
-
VERSION = "0.1.
|
3
|
-
end
|
2
|
+
VERSION = "0.1.1"
|
3
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: add_symbolic_names
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben VandenBos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|