fedux_org-stdlib 0.10.6 → 0.10.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: 38a7a8abc9d4d7cf4c50f92c9b70e5ea646fcdc6
4
- data.tar.gz: 357914ff9e53a7e399355cfd3ea5d5993b8b5c0a
3
+ metadata.gz: 581b510bdcfc031ca357feb35d1cc3eb7bfb1ce3
4
+ data.tar.gz: 83bb71f27a2a1fdaedaa7dce820eb6a28f12abdb
5
5
  SHA512:
6
- metadata.gz: ac9ea48663fca754aa7abc3df0f488db467bc75510c7febb8644cc43db1349c90f018b4428beb3bd11625acc2a22163569b61d3217c1277cee966551da2b232e
7
- data.tar.gz: 98fc091c17ba1e341a7e7451ae774630cff1292f32bc777bb08fa952572e64b5088eb4cbf9588547141734196259ae14a3147b11899f3e1987458f6ede501e08
6
+ metadata.gz: 08a3e1bb4d16d5fb11e834738b725074570c8f3007335c5ef92937aca92173a975dd43d65b0233b120412bd7a4746f6bac007f23843ba031d09c20ab7747310f
7
+ data.tar.gz: 0198151c482ece2ab1a45953907a8156e8e6824cb960e0c5faa8b693c06c92b1e93863f9403cf14d67794dd0e39d1452773d5575defa283edbce2c65d5378c4c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fedux_org-stdlib (0.10.5)
4
+ fedux_org-stdlib (0.10.6)
5
5
  activesupport
6
6
 
7
7
  PATH
@@ -285,8 +285,13 @@ module FeduxOrgStdlib
285
285
  end
286
286
  end
287
287
 
288
- def to_yaml(**args)
289
- Psych.dump to_h(**args).deep_stringify_keys
288
+ # Convert config to yaml
289
+ def to_yaml(prepend: nil, **args)
290
+ yaml = Psych.dump to_h(**args).deep_stringify_keys
291
+
292
+ return yaml.split("\n").map { |l| l.prepend prepend }.join("\n") if prepend
293
+
294
+ yaml
290
295
  end
291
296
 
292
297
  private
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.10.6'
4
+ VERSION = '0.10.7'
5
5
  end
@@ -644,9 +644,7 @@ RSpec.describe AppConfig do
644
644
  it 'dumps configuration to yaml' do
645
645
  config_klass = Class.new(AppConfig) do
646
646
  option :opt1, 'test1'
647
-
648
647
  option :opt2, %w(test2 test2)
649
-
650
648
  option :opt3, test3: 'value3'
651
649
 
652
650
  def _class_name
@@ -673,9 +671,7 @@ RSpec.describe AppConfig do
673
671
  it 'filters keys' do
674
672
  config_klass = Class.new(AppConfig) do
675
673
  option :opt1, 'test1'
676
-
677
674
  option :opt2, %w(test2 test2)
678
-
679
675
  option :opt3, test3: 'value3'
680
676
 
681
677
  def _class_name
@@ -695,5 +691,33 @@ RSpec.describe AppConfig do
695
691
  opt1: test1
696
692
  EOS
697
693
  end
694
+
695
+ it 'prepends lines' do
696
+ config_klass = Class.new(AppConfig) do
697
+ option :opt1, 'test1'
698
+ option :opt2, %w(test2 test2)
699
+ option :opt3, test3: 'value3'
700
+
701
+ def _class_name
702
+ 'TestConfig'
703
+ end
704
+
705
+ def _module_name
706
+ 'MyApplication'
707
+ end
708
+ end
709
+
710
+ config = config_klass.new
711
+ expect(config.to_yaml(prepend: '# ')).to eq <<-EOS.strip_heredoc.chomp
712
+ # ---
713
+ # opt1: test1
714
+ # opt2:
715
+ # - test2
716
+ # - test2
717
+ # opt3:
718
+ # test3: value3
719
+ EOS
720
+ end
721
+
698
722
  end
699
723
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fedux_org-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.6
4
+ version: 0.10.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2014-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport