fedux_org-stdlib 0.9.6 → 0.9.7
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/fedux_org_stdlib/app_config.rb +1 -1
- data/lib/fedux_org_stdlib/version.rb +1 -1
- data/spec/app_config_spec.rb +29 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85edeb5ce1dea914027cf67c0a10424450625e7a
|
4
|
+
data.tar.gz: ec5c25b916a977aa3366f1b17bdea84e22390f6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e11b2cfae8c98090280fdd2b432fae1c06b731737ab2e9f1c86813e40f81850d38e79977360f07dcd365dc7ff2886b0fe59834fd60974530c4cdc34e711ade2c
|
7
|
+
data.tar.gz: 18291e966cf0a7946112f9e5c7dd26380490ffe27f9d2ada60e835cd22f8564324dfab26bd9af93f23aa10617800be4ee1d88c5036e5c37b45cc54d5bf7f1c01
|
data/Gemfile.lock
CHANGED
@@ -277,7 +277,7 @@ module FeduxOrgStdlib
|
|
277
277
|
end
|
278
278
|
|
279
279
|
def to_h(keys: [], remove_blank: false)
|
280
|
-
options_to_check = known_options.delete_if { |o| !keys.blank? && !keys.include?(o) }
|
280
|
+
options_to_check = known_options.delete_if { |o| !keys.blank? && !keys.map(&:to_sym).include?(o) }
|
281
281
|
|
282
282
|
options_to_check.each_with_object({}) do |e, a|
|
283
283
|
next if remove_blank && self.public_send(e).blank?
|
data/spec/app_config_spec.rb
CHANGED
@@ -576,7 +576,7 @@ RSpec.describe AppConfig do
|
|
576
576
|
)
|
577
577
|
end
|
578
578
|
|
579
|
-
it 'filters keys by
|
579
|
+
it 'filters keys by symbols' do
|
580
580
|
config_klass = Class.new(AppConfig) do
|
581
581
|
option :opt1, 'test1'
|
582
582
|
|
@@ -604,6 +604,34 @@ RSpec.describe AppConfig do
|
|
604
604
|
)
|
605
605
|
end
|
606
606
|
|
607
|
+
it 'filters keys by strings' do
|
608
|
+
config_klass = Class.new(AppConfig) do
|
609
|
+
option :opt1, 'test1'
|
610
|
+
|
611
|
+
option :opt2, [
|
612
|
+
'test2',
|
613
|
+
'test2',
|
614
|
+
]
|
615
|
+
|
616
|
+
option :opt3, {
|
617
|
+
test3: 'value3'
|
618
|
+
}
|
619
|
+
|
620
|
+
def _class_name
|
621
|
+
'TestConfig'
|
622
|
+
end
|
623
|
+
|
624
|
+
def _module_name
|
625
|
+
'MyApplication'
|
626
|
+
end
|
627
|
+
end
|
628
|
+
|
629
|
+
config = config_klass.new
|
630
|
+
expect(config.to_h(keys: ['opt1'])).to eq(
|
631
|
+
opt1: 'test1'
|
632
|
+
)
|
633
|
+
end
|
634
|
+
|
607
635
|
it 'filters keys if nil' do
|
608
636
|
config_klass = Class.new(AppConfig) do
|
609
637
|
option :opt1, 'test1'
|