astrolabe 1.1.0 → 1.2.1
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/.rubocop.yml +3 -0
- data/CHANGELOG.md +10 -0
- data/lib/astrolabe.rb +1 -0
- data/lib/astrolabe/sexp.rb +15 -0
- data/lib/astrolabe/version.rb +2 -2
- data/spec/astrolabe/sexp_spec.rb +25 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 533fadbcceb5e0b4521256ffa902fa7cecd2b7b0
|
4
|
+
data.tar.gz: 03fb83e3bcd917fb63ff123a476b86492c28b62b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a1ed3ae0bc7f231d84c01913e012eb46a32ff5020d26f43a88b0c3875a923901f8ebb6992a2b13e7c83400beadeee636aa8450d1a216563d968206cff7fc5f0
|
7
|
+
data.tar.gz: 09409b8f6460607cbb64140439f878e635926e51e10941860ce60217b66618b1622e0f137cf8a2890f44d012ac74ee2394666a46594bda5506451344a919b155
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
## Development
|
4
4
|
|
5
|
+
## v1.2.1
|
6
|
+
|
7
|
+
* Re-release 1.2.0 due to an error in `rubygems.org`.
|
8
|
+
|
9
|
+
## v1.2.0
|
10
|
+
|
11
|
+
* Add `Astrolabe::Sexp` module which provides a shorthand method to create a node like [`AST::Sexp`](http://rubydoc.info/gems/ast/AST/Sexp).
|
12
|
+
|
13
|
+
## v1.1.0
|
14
|
+
|
5
15
|
* Add `Node#ancestors`, `Node#child_nodes` and `Node#descendants` which return an array instead of enumerator.
|
6
16
|
|
7
17
|
## v1.0.0
|
data/lib/astrolabe.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'astrolabe/node'
|
4
|
+
|
5
|
+
module Astrolabe
|
6
|
+
# This module provides a shorthand method to create a {Node} like `AST::Sexp`.
|
7
|
+
#
|
8
|
+
# @see http://rubydoc.info/gems/ast/AST/Sexp
|
9
|
+
module Sexp
|
10
|
+
# Creates a {Node} with type `type` and children `children`.
|
11
|
+
def s(type, *children)
|
12
|
+
Node.new(type, children)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/astrolabe/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'astrolabe/sexp'
|
4
|
+
|
5
|
+
module Astrolabe
|
6
|
+
describe Sexp do
|
7
|
+
include Sexp
|
8
|
+
|
9
|
+
describe '.s' do
|
10
|
+
subject(:node) { s(:lvar, :foo) }
|
11
|
+
|
12
|
+
it 'returns an instance of Astrolabe::Node' do
|
13
|
+
expect(node).to be_a(::Astrolabe::Node)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'sets the passed type to the node' do
|
17
|
+
expect(node.type).to eq(:lvar)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'sets the passed children to the node' do
|
21
|
+
expect(node.children).to eq([:foo])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: astrolabe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
@@ -201,9 +201,11 @@ files:
|
|
201
201
|
- lib/astrolabe.rb
|
202
202
|
- lib/astrolabe/builder.rb
|
203
203
|
- lib/astrolabe/node.rb
|
204
|
+
- lib/astrolabe/sexp.rb
|
204
205
|
- lib/astrolabe/version.rb
|
205
206
|
- spec/.rubocop.yml
|
206
207
|
- spec/astrolabe/node_spec.rb
|
208
|
+
- spec/astrolabe/sexp_spec.rb
|
207
209
|
- spec/spec_helper.rb
|
208
210
|
- spec/support/shared_contexts.rb
|
209
211
|
homepage: https://github.com/yujinakayama/astrolabe
|
@@ -233,6 +235,7 @@ summary: An object-oriented AST extension for Parser
|
|
233
235
|
test_files:
|
234
236
|
- spec/.rubocop.yml
|
235
237
|
- spec/astrolabe/node_spec.rb
|
238
|
+
- spec/astrolabe/sexp_spec.rb
|
236
239
|
- spec/spec_helper.rb
|
237
240
|
- spec/support/shared_contexts.rb
|
238
241
|
has_rdoc:
|