arendelle 0.1.1 → 0.1.2
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/arendelle.rb +10 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 523b30b2cc032df7c6c627f35d59f5a31e5ec9b2
|
4
|
+
data.tar.gz: eb0b465143b28086f212b5ead8fa2c9d10f07b3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 774721dc4e9d1100b9ccbd20170c27d691b8a2d71c26bfc93d71cb2e0f0a999a75c313c4c681d7282c8164c9571c57a160977538e70e1949108f6960bce16c70
|
7
|
+
data.tar.gz: ec07f81ed7d49c06fe625228953ff0ab2ee8135d8a3f4cc609c34c6a023e412c29db737738dba16e67a1144c207fb03f083c321d43c3b94c559bd670b5d72a71
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## [0.1.2] - 2017-11-03
|
2
|
+
|
3
|
+
Added #to_h to allow conversion of objects to hashes, allowing for easier
|
4
|
+
testing via hash comparison.
|
5
|
+
|
1
6
|
## [0.1.1] - 2017-03-20
|
2
7
|
|
3
8
|
Added support for handling JSON keys that start with integers. Previously this was attempting to use an invalid instance variable ("@1234"). New behavior prepends instance variables and method access calls with an underscore: `obj._1234` or `obj.instance_variable_get("_@1234")`.
|
data/lib/arendelle.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Arendelle
|
2
|
-
VERSION = "0.1.
|
2
|
+
VERSION = "0.1.2"
|
3
3
|
|
4
4
|
def initialize(**opts)
|
5
5
|
opts.each { |k, v| self[k] = v }
|
@@ -21,6 +21,15 @@ class Arendelle
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
def to_h
|
26
|
+
instance_variables.each_with_object({}) do |ivar, hash|
|
27
|
+
key = ivar.to_s[2..-1]
|
28
|
+
value = send(key)
|
29
|
+
new_value = value.is_a?(Arendelle) ? value.to_h : value
|
30
|
+
hash[key.to_sym] = new_value
|
31
|
+
end
|
32
|
+
end
|
24
33
|
end
|
25
34
|
|
26
35
|
class FrozenVariableError < StandardError
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arendelle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Cole
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
93
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.6.
|
94
|
+
rubygems_version: 2.6.11
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: A simple gem for creating mostly frozen objects. Useful for configuration-like
|