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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2bc1979d804f1f5ae8a0e848eeeb2bbb2dd1f6f7
4
- data.tar.gz: 366a494106df785d9414a99a85fa75b59eb91e73
3
+ metadata.gz: 85edeb5ce1dea914027cf67c0a10424450625e7a
4
+ data.tar.gz: ec5c25b916a977aa3366f1b17bdea84e22390f6d
5
5
  SHA512:
6
- metadata.gz: 05d1baba5c6dc9aee2668573546b2b6c157321381b88e0b2674a71cbe22ec8a12bc55e2c6baf674e00f0f259722aeef9f5b08fd16b616498ebbdb8e026f666b9
7
- data.tar.gz: 30af0bab6bcf6e354b1489ae5f9d87a01d3a9cfe9dde1cb9fb715b061e330a48607b50bf768b56910e24c1d5295aa3554a4293d9510970c34090712cad4bf3cf
6
+ metadata.gz: e11b2cfae8c98090280fdd2b432fae1c06b731737ab2e9f1c86813e40f81850d38e79977360f07dcd365dc7ff2886b0fe59834fd60974530c4cdc34e711ade2c
7
+ data.tar.gz: 18291e966cf0a7946112f9e5c7dd26380490ffe27f9d2ada60e835cd22f8564324dfab26bd9af93f23aa10617800be4ee1d88c5036e5c37b45cc54d5bf7f1c01
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fedux_org-stdlib (0.9.5)
4
+ fedux_org-stdlib (0.9.6)
5
5
  activesupport
6
6
 
7
7
  PATH
@@ -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?
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.9.6'
4
+ VERSION = '0.9.7'
5
5
  end
@@ -576,7 +576,7 @@ RSpec.describe AppConfig do
576
576
  )
577
577
  end
578
578
 
579
- it 'filters keys by name' do
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'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fedux_org-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer