jsos 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/jsos.gemspec +1 -1
  4. data/lib/jsos.rb +16 -0
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5017d52aafb4da08828b5e6c6632aca0495f3faa
4
- data.tar.gz: 7c8c9c0408fb5700d4af286094dd18e5d2cba523
3
+ metadata.gz: 98bbf0dc84ae37f267f3f795ec596ca7fbde666e
4
+ data.tar.gz: cbcbf2375ece3fb7501ad39ef1fa1e937d2a73f1
5
5
  SHA512:
6
- metadata.gz: 5573d049d3a16ff1f5035db0a1130446d23b3619f461ebd6ae7783072e28d956fe4223af5c601a3517dde4b656b810cc07ed6372bf460f8dea47ba08e92c6e0f
7
- data.tar.gz: 18467c15348709c8e1cda425f8680f7f116cd04ef7576edf00d344a16ed7d62efd397d374b8ff19cb19f42985860b5ba808473cd5398b2c1118f1fcdab41dbfc
6
+ metadata.gz: dc8179e390b241bd32a276cb245aff3e58df030f60b17ba2a2a6a09a21c5a7a4278a250a4141384013c6f33e92868a5e518cd37c25372211146876a77889eb35
7
+ data.tar.gz: 4f4636e94061e28093149c2c795cba5f22cb8c9647edf0178f1cdc4c8f8298c65fb3d46c606e8391e8c8b8dc743e7feb6e296668ad34e38b958d9a8487fca48b
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v1.2.0 (Jan 13, 2016)
4
+ * Add `JSOS#to_a`
5
+ * Alias `JSOS#to_a` to `JSOS#to_ary`
6
+
3
7
  ## v1.1.0 (Jan 12, 2016)
4
8
  * Add `JSOS#each`
5
9
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "jsos"
7
- spec.version = "1.1.0"
7
+ spec.version = "1.2.0"
8
8
  spec.authors = ["Johnson Denen"]
9
9
  spec.email = ["johnson.denen@gmail.com"]
10
10
 
@@ -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.1.0
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-12 00:00:00.000000000 Z
11
+ date: 2016-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler