jsos 1.1.0 → 1.2.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/jsos.gemspec +1 -1
- data/lib/jsos.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98bbf0dc84ae37f267f3f795ec596ca7fbde666e
|
4
|
+
data.tar.gz: cbcbf2375ece3fb7501ad39ef1fa1e937d2a73f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc8179e390b241bd32a276cb245aff3e58df030f60b17ba2a2a6a09a21c5a7a4278a250a4141384013c6f33e92868a5e518cd37c25372211146876a77889eb35
|
7
|
+
data.tar.gz: 4f4636e94061e28093149c2c795cba5f22cb8c9647edf0178f1cdc4c8f8298c65fb3d46c606e8391e8c8b8dc743e7feb6e296668ad34e38b958d9a8487fca48b
|
data/CHANGELOG.md
CHANGED
data/jsos.gemspec
CHANGED
data/lib/jsos.rb
CHANGED
@@ -47,6 +47,7 @@ class JSOS < OpenStruct
|
|
47
47
|
super parse_state_hash(state_hash)
|
48
48
|
end
|
49
49
|
|
50
|
+
# Convert the object to a Hash.
|
50
51
|
# @return [Hash]
|
51
52
|
def to_h
|
52
53
|
@table.each_with_object({}) do |(key, value), new_hash|
|
@@ -54,25 +55,40 @@ class JSOS < OpenStruct
|
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
58
|
+
# Convert the object to a JSON string.
|
57
59
|
# @return [String]
|
58
60
|
def to_json
|
59
61
|
self.to_h.to_json
|
60
62
|
end
|
61
63
|
|
64
|
+
# Return all method names on the object.
|
62
65
|
# @return [Array<Symbol>]
|
63
66
|
def keys
|
64
67
|
self.to_h.keys
|
65
68
|
end
|
66
69
|
|
70
|
+
# Return all method values on the object.
|
67
71
|
# @return [Array]
|
68
72
|
def values
|
69
73
|
self.to_h.values
|
70
74
|
end
|
71
75
|
|
76
|
+
# Yield to block for each method on the object, passing method
|
77
|
+
# name and value as parameters to the block.
|
78
|
+
# @see [Enumerator#each]
|
79
|
+
# @return [Hash|Enumerator]
|
72
80
|
def each &block
|
73
81
|
self.to_h.each{ |k, v| yield k, v }
|
74
82
|
end
|
75
83
|
|
84
|
+
# Convert the object to an Array.
|
85
|
+
# @return [Array]
|
86
|
+
def to_a
|
87
|
+
self.to_h.to_a
|
88
|
+
end
|
89
|
+
alias_method :to_ary, :to_a
|
90
|
+
|
91
|
+
# Return false if no methods exist on the object. Otherwise, true.
|
76
92
|
# @return [true|false]
|
77
93
|
def empty?
|
78
94
|
@table.empty?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johnson Denen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|