sting 0.2.0 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 271132274baa28e3ded663cbd4abda0b371b948cdc71b2a6b1cd6a9e0dd444aa
4
- data.tar.gz: 424dc73b1871a68e87f0206b354a40995f9fef20a9b35892d0ec71102f293c0c
3
+ metadata.gz: 9da68de98fcd9fbce26a849c35a5b097a22450557cd24e527eab9092f3c599e8
4
+ data.tar.gz: df652164022a1a6e0eec2dd72f0decd7abd67ecfca7b10e8c690244bf22d6a61
5
5
  SHA512:
6
- metadata.gz: aa0836070e5db815867796c726b4e3eea387d9f3fd859ecb17abe770d224994142c478295f4340eeecb5f42e89a39f3dbd18374ca4b76f50d361675930704093
7
- data.tar.gz: ba50fce961c36bee99fbbc05b8ab06dcbda5112d26d04a14f0320df572fdba9791f062d9cc7bd6cb25ad72f9de40f2dd8f231d5266efd3a4cce0636c308f033e
6
+ metadata.gz: b737ad0f01853e105bc42dba547eb92a8e36d95ec339e6f51b476ebd1ca12bad519575dd8d90237c74fc5f9f965fe6d236812a180664dfac44a3f357153839bc
7
+ data.tar.gz: 48545f0c95f2b7d91bea94220d4ab9dec740235438edb1856c4219f2539ec9975f1b22f19bebf9da30a0ff6b7d23f50d910a6f1cf5924b5e7179525320169434
data/README.md CHANGED
@@ -4,7 +4,6 @@ Sting - Minimal Settings Library
4
4
  [![Gem Version](https://badge.fury.io/rb/sting.svg)](https://badge.fury.io/rb/sting)
5
5
  [![Build Status](https://travis-ci.com/DannyBen/sting.svg?branch=master)](https://travis-ci.com/DannyBen/sting)
6
6
  [![Maintainability](https://api.codeclimate.com/v1/badges/c8afe395a8f2cf290fec/maintainability)](https://codeclimate.com/github/DannyBen/sting/maintainability)
7
- [![Test Coverage](https://api.codeclimate.com/v1/badges/c8afe395a8f2cf290fec/test_coverage)](https://codeclimate.com/github/DannyBen/sting/test_coverage)
8
7
 
9
8
  ---
10
9
 
@@ -60,7 +59,7 @@ require 'sting'
60
59
  # If you want to use a different name than Sting (optional)
61
60
  Settings = Sting
62
61
 
63
- # Load some YAML files. If the provided filename does end with '.yml' or
62
+ # Load some YAML files. If the provided filename does not end with '.yml' or
64
63
  # '.yaml', we will add '.yml' to it.
65
64
  Settings << 'one'
66
65
  Settings << 'two.yml'
@@ -81,7 +80,11 @@ p Settings[:host]
81
80
  # Access nested values
82
81
  p Settings.server['host']
83
82
 
84
- # Access all values
83
+ # Access nested values safely (get nil if any of the keys does not exist)
84
+ p Settings[:server, :host]
85
+ p Settings[:server, :production, :host]
86
+
87
+ # Get the hash of all values
85
88
  p Settings.settings
86
89
 
87
90
  # Check if a key is defined
@@ -19,8 +19,8 @@ class Sting
19
19
  end
20
20
  alias_method :push, :<<
21
21
 
22
- def [](key)
23
- settings[key.to_s]
22
+ def [](*keys)
23
+ settings.dig *keys.map(&:to_s)
24
24
  end
25
25
 
26
26
  def method_missing(name, *args, &blk)
data/lib/sting/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Sting
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-05 00:00:00.000000000 Z
11
+ date: 2019-10-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Minimal, lightweight, multi-YAML settings
14
14
  email: db@dannyben.com
@@ -39,8 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  requirements: []
42
- rubyforge_project:
43
- rubygems_version: 2.7.6
42
+ rubygems_version: 3.0.4
44
43
  signing_key:
45
44
  specification_version: 4
46
45
  summary: Minimal, lightweight, multi-YAML settings