syntax_tree_ext 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f369f11506e5b0deee505fd45a2dc9528dcc949afbd3c251445976e74a5e1e34
4
- data.tar.gz: d7c8c612139042547ea4a3b94e4b22d09776763a9a1abaa1f55a16857b56a94c
3
+ metadata.gz: f9580df1305b4def597a9e270f05b42f5f8bc5704f433c4a0e5356591f0de7e5
4
+ data.tar.gz: b0264ef9b6a63c83918ef57dc38062da7fcf09e688fc756be3f21c15b4e64501
5
5
  SHA512:
6
- metadata.gz: ba91207069dff6049b134b310065ba6443834bbc43e9e0f1a161ff16d8e3d20d781df00364e9633cd71e07d870827ccedd15fa0eecd32e7a02fd82d89daea180
7
- data.tar.gz: 054e6676cf631d02cc37f620d3bc5689463e38054217a972d0cd5108077ce8e852881e9b1995a3158eb4b9e930de3b3523ab757e0871f979df8bf95791765fb6
6
+ metadata.gz: 22f20003979d6dd4ed263098327362f932944e59b5278b7c68ed7261a2465dfbfd14fd617ab04c474358564de0ba44ebc4ce11475dad84fe673842afb679de26
7
+ data.tar.gz: e36f96c71b3359547c1bac1e15e8bcfa4ce724ac82d6f0a8b8750208e546af9bb7bf92a3b38459c40195299429bfebaf8040eddda1fe17b5cb1dcf7a23939553
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.5.0 (2023-06-12)
4
+
5
+ * Add `keys` and `values` for hash
6
+
3
7
  ## 0.4.1 (2023-06-11)
4
8
 
5
9
  * Support `const` for `to_value`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- syntax_tree_ext (0.4.1)
4
+ syntax_tree_ext (0.5.0)
5
5
  syntax_tree
6
6
 
7
7
  GEM
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SyntaxTreeExt
4
- VERSION = "0.4.1"
4
+ VERSION = "0.5.0"
5
5
  end
@@ -38,6 +38,22 @@ module SyntaxTree
38
38
  parent_node.child_nodes[index + 1...]
39
39
  end
40
40
 
41
+ def keys
42
+ if is_a?(BareAssocHash) || is_a?(HashLiteral)
43
+ assocs.map(&:key)
44
+ else
45
+ raise MethodNotSupported, "keys is not supported for #{self}"
46
+ end
47
+ end
48
+
49
+ def values
50
+ if is_a?(BareAssocHash) || is_a?(HashLiteral)
51
+ assocs.map(&:value)
52
+ else
53
+ raise MethodNotSupported, "values is not supported for #{self}"
54
+ end
55
+ end
56
+
41
57
  def to_value
42
58
  case self
43
59
  when SymbolLiteral
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntax_tree_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-11 00:00:00.000000000 Z
11
+ date: 2023-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: syntax_tree