yaml_enumeration 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +3 -0
- data/lib/yaml_enumeration/configuration.rb +14 -0
- data/lib/yaml_enumeration/enumeration.rb +9 -1
- data/lib/yaml_enumeration/version.rb +1 -1
- data/lib/yaml_enumeration.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 789056e38408fc39c5203d9b27347d67eac1223a005c4e97d6c3fbb0b50e52c9
|
4
|
+
data.tar.gz: f687bbcc331fa6959225a5701721b156ae652dc5c51540f4a85d2b8c75d66ab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 937de680ad7a668d42faa880eac779d53d0bfb9833bfdf981f50c97cf3703d113de49e550b3290ae27c9a7ca7173d44b0630cbf5922a07e60464b98886cb20e5
|
7
|
+
data.tar.gz: bc24da29146aac8453d17badffaf83176dc8c937d54eff3660ead43b8261237445741c1db95fff163bdf8f0fddeb80adc6e2f925573f3aa2d71604a4c05b3b8d
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -13,7 +13,7 @@ module YamlEnumeration
|
|
13
13
|
|
14
14
|
def self.load_values(filename)
|
15
15
|
file = File.join(Rails.root, 'db', 'enumerations', "#{filename}.yml")
|
16
|
-
remove_exclusions(
|
16
|
+
remove_exclusions(yaml_load(ERB.new(File.read(file)).result)).values.each do |data|
|
17
17
|
value data.symbolize_keys
|
18
18
|
end
|
19
19
|
end
|
@@ -126,6 +126,14 @@ module YamlEnumeration
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
+
def yaml_load(source)
|
130
|
+
begin
|
131
|
+
YAML.load(source, aliases: true, permitted_classes: Configuration.permitted_classes)
|
132
|
+
rescue ArgumentError
|
133
|
+
YAML.load(source, permitted_classes: Configuration.permiitted_classes)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
129
137
|
# Define singleton methods .BLAH for each type
|
130
138
|
def with_named_items(column = :type)
|
131
139
|
all.each do |item|
|
data/lib/yaml_enumeration.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml_enumeration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thorsten Boettger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- bin/setup
|
116
116
|
- lib/yaml_enumeration.rb
|
117
117
|
- lib/yaml_enumeration/association.rb
|
118
|
+
- lib/yaml_enumeration/configuration.rb
|
118
119
|
- lib/yaml_enumeration/enumeration.rb
|
119
120
|
- lib/yaml_enumeration/railtie.rb
|
120
121
|
- lib/yaml_enumeration/version.rb
|
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
- !ruby/object:Gem::Version
|
139
140
|
version: '0'
|
140
141
|
requirements: []
|
141
|
-
rubygems_version: 3.
|
142
|
+
rubygems_version: 3.3.26
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: Create ActiveRecord enumerations based on YAML files.
|