data_crate 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/crate/crate.rb +7 -4
- data/lib/crate/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2f68e24db8a02b02e05cc10d54b34c04e2636d11d3a6e96466dc64584ac732e
|
4
|
+
data.tar.gz: 8f4d80b7177ed6fb02a96b06eb3d91fe432bcf6e0676d2ef50b57fcb28217a5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0169f00f004407f0bd56a2feb094ce98cba818c9f850ffbddfd00e7b594255c53d5752e027df0d0a6adcc66235f8bad4be215c6c0dcede0c63398852b668bb3b'
|
7
|
+
data.tar.gz: ac28099a262a461332ce89e88bc0d92b79745dd4809bb31dccfdb3ce116cf5692afc7bec9e5fddfa8adc5ce749534fdbdec40dbb47705e8707432cdbdd5a6b09
|
data/Gemfile.lock
CHANGED
data/lib/crate/crate.rb
CHANGED
@@ -129,9 +129,7 @@ module Crate
|
|
129
129
|
@_raw = Raw.new(raw, **_options).to_hash
|
130
130
|
_new_crates
|
131
131
|
_run_hooks
|
132
|
-
|
133
|
-
return if self.class._crate_klasses.empty?
|
134
|
-
_select_klass(_find_valid_klass(raw, **options))
|
132
|
+
_select_klass_if_exist(**options)
|
135
133
|
end
|
136
134
|
|
137
135
|
def _new_crates
|
@@ -146,6 +144,11 @@ module Crate
|
|
146
144
|
self.class._hooks.each { |hook| instance_eval(&hook) }
|
147
145
|
end
|
148
146
|
|
147
|
+
def _select_klass_if_exist(**options)
|
148
|
+
return if self.class._crate_klasses.empty?
|
149
|
+
_select_klass(_find_valid_klass(_raw, **options))
|
150
|
+
end
|
151
|
+
|
149
152
|
def _find_valid_klass(*args)
|
150
153
|
self.class._crate_klasses.find do |klass|
|
151
154
|
klass._valid_crate?(*args)
|
@@ -165,7 +168,7 @@ module Crate
|
|
165
168
|
|
166
169
|
def _select_klass(klass)
|
167
170
|
_exit_if_no_klass(klass)
|
168
|
-
@_crate = klass.new(
|
171
|
+
@_crate = klass.new(_raw, **_options)
|
169
172
|
(methods - REJECT_METHODS).each do |method_name|
|
170
173
|
instance_eval("undef #{method_name.inspect}")
|
171
174
|
end
|
data/lib/crate/version.rb
CHANGED