tiny_dot 1.1.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tiny_dot.rb +12 -0
  3. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b67c64a2b6cadaf03f5e884c7a19e24bca0e456b52793abc711a1910066fdc4a
4
- data.tar.gz: 57afdc1cfe4401662697cc4323744e335cbf5bd6b024455805405fa78fbb92d3
3
+ metadata.gz: 43431e5a7057bc2f6cf613a04764ebffc73888e179a410e584175a82deec7c95
4
+ data.tar.gz: 2cd49f38c092aaf60dcd54fc6050aa74daa20d018e0b67d5b7ac29feaf0f7130
5
5
  SHA512:
6
- metadata.gz: bfc3a8f0631a7c45ce9c32e12e0f2decbe63365fa7cc6bf942238d6b6c46c3c3c711e1c06a34532c4a819150e1b37bc60889c9eb9e2032753889d39e22b1e676
7
- data.tar.gz: 952e378985a8fc2e74ff944a5dda98f2d255ee3a279f254e2dcf2c64a3671f554c04002af59b506ef6c1fe8a155195b2576d760505a05bb1e8099f9e10dd5665
6
+ metadata.gz: 4fc483e2b724ae9280106ac16eb95579638f1209a41f2d5a7f8a65c0113355376c35040fc498ac4e8ee9b4837e6e4823640ae4170f45b181c92243d1a2d60ffd
7
+ data.tar.gz: ffa636fb014db58d0cac5095af7a1f0737489482524c12facd792540f320984d26e79eb713cffdda89bd9530397b26889757281e4caedc935914f6d753ef8786
data/lib/tiny_dot.rb CHANGED
@@ -27,6 +27,11 @@ require 'json'
27
27
  # ... which is sort of safe navigation operator-like without the save
28
28
  # navigation operator
29
29
  class TinyDot
30
+ # returns a TinyDot instance from the ENV constant
31
+ def self.from_env
32
+ TinyDot.new(ENV)
33
+ end
34
+
30
35
  # returns a TinyDot instance after parsing the YAML in the named filename
31
36
  def self.from_yaml_file(filename)
32
37
  TinyDot.new(YAML.safe_load_file(filename))
@@ -65,6 +70,13 @@ class TinyDot
65
70
  @data.to_json
66
71
  end
67
72
 
73
+ # NOTE: this returns the raw hash inside of the TinyDot instance, which means
74
+ # if you modify anything here you're modifying the internal data in this
75
+ # TinyDot instance
76
+ def to_hash
77
+ @data
78
+ end
79
+
68
80
  def to_yaml
69
81
  @data.to_yaml
70
82
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_dot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lunt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-18 00:00:00.000000000 Z
11
+ date: 2022-11-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: a tiny read-only, dot notation wrapper for Hash, JSON, and YAML
13
+ description: a tiny read-only, dot notation wrapper for Hash, JSON, YAML, and ENV
14
14
  email: jefflunt@gmail.com
15
15
  executables: []
16
16
  extensions: []
@@ -21,7 +21,7 @@ homepage: https://github.com/jefflunt/tiny_dot
21
21
  licenses:
22
22
  - MIT
23
23
  metadata: {}
24
- post_install_message:
24
+ post_install_message:
25
25
  rdoc_options: []
26
26
  require_paths:
27
27
  - lib
@@ -36,8 +36,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
38
  requirements: []
39
- rubygems_version: 3.0.3.1
40
- signing_key:
39
+ rubygems_version: 3.3.7
40
+ signing_key:
41
41
  specification_version: 4
42
42
  summary: want to have easy dot notation access to data that comes from Hashes, JSON,
43
43
  and YAML - and absolutely nothing else? then this is the library for you.