confrb 1.7 → 1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/confrb.rb +6 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8dfa076ab1375b93293ff60476790ab13290dabef9a11fc548bf9ec72de19b3
4
- data.tar.gz: 5cb5e6b28791faa5a5b55e20901effeee961f96c1f7e82d628d5ede60725a580
3
+ metadata.gz: 56a83b4fa46ce5e7cf508babd19e67bc988d68648083c00d549a744e866514bf
4
+ data.tar.gz: 13a6ca74daedef594fd197e5c37dce61b8dde613355d75dc755f9ce94853c330
5
5
  SHA512:
6
- metadata.gz: e756e3bddb9c8970be8ead63eafd0d499e84b4e5992c216feacf1815260c0e2e529a1b12be64461e17f6f3e7c45ec8706ad89a9bff5247e8110fc8d9f5964ae1
7
- data.tar.gz: ed0d486f91a42faed7a2b3d571b8e6c290cd2d2775792477485aa434ebb4e80a0d822e9f6e8bf209dc984d6627a981c4e3783bf1a54f2214e03f6f246e297b45
6
+ metadata.gz: 4e5b81841ee2f41d034b1852c31dbf4ce541367c1d744b5c83866d775a3a185dfc21e9ccb310e1bff0eb7d37e8fa6ca94857458547b269c07bb10f3b39fd7d3f
7
+ data.tar.gz: 3e1105f85c8742450774296f0fe39c0b1b26746fd8e8e30603347b7a35611029c18a896c0807c43bde3d952849072fac589ad901c47413bad1d073ff4f256f11
@@ -18,7 +18,7 @@ class Confrb
18
18
  end
19
19
 
20
20
  ##
21
- # Access the given database, prepending '.' to given name. Auto-create if doesn't exist.
21
+ # Access the given database, prepending '.' to given name. Raises an exception if nonexistent.
22
22
  # @param [String] db The name of the configuration directory to access
23
23
  def self.access(db)
24
24
  if Dir.exist? '.' + db
@@ -30,8 +30,9 @@ class Confrb
30
30
 
31
31
  ##
32
32
  # Create/overwrite a config file and write data to it. Can
33
- # serialize a hash as yaml or json, or write a string
34
- # @param [String] cfgname Name of config file to write to
33
+ # serialize a hash as yaml or json, or write a string.
34
+ # @param [String] cfgname Name of config file to write to
35
+ # @param [String] content The content to write, defaults to an empty string.
35
36
  # @param [Hash] opts Optional param hash
36
37
  # @option opts [boolean] :json If true, serialize content
37
38
  # as JSON (ignored if content isn't a hash) Default #
@@ -40,7 +41,7 @@ class Confrb
40
41
  # as YAML (ignored if content isn't a hash) Default #
41
42
  # false (json: true takes precedence)
42
43
  # @return path to configuration file created.
43
- def mkcfg(cfgname, content, opts = {})
44
+ def mkcfg(cfgname, content='', opts = {})
44
45
  as_json = opts.fetch(:json, false) && content.is_a?(Hash)
45
46
  as_yaml = opts.fetch(:yaml, false) && content.is_a?(Hash)
46
47
  dotdir = "." + @db
@@ -124,6 +125,7 @@ class Confrb
124
125
  # Create/append to a config file. Can
125
126
  # serialize a hash as yaml or json, or write a string
126
127
  # @param [String] cfgname Name of config file to write to
128
+ # @param [String] content The content to write.
127
129
  # @param [Hash] opts Optional param hash
128
130
  # @option opts [boolean] :json If true, serialize content
129
131
  # as JSON (ignored if content isn't a hash) Default #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confrb
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.7'
4
+ version: '1.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gurjus Bhasin