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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0261eb0ca33d240e771b36abd56920b8434a4fb7
4
- data.tar.gz: 427cba57b3afdc25097c51554c98a3f7177214b3
3
+ metadata.gz: 533fadbcceb5e0b4521256ffa902fa7cecd2b7b0
4
+ data.tar.gz: 03fb83e3bcd917fb63ff123a476b86492c28b62b
5
5
  SHA512:
6
- metadata.gz: c6372f0ce3b7208e01c1308061dbc50474fadeff0f4e6eafaece7f52b4661d35a81715bea5b3e758bce5ad508ff3450552077b3c6361e134d2ef9e0b17c5b89f
7
- data.tar.gz: 275c1ce0a24de0ec1e28a7805b5939502ded932ed37c054f985f2760cff9169e4438761293429eedee709fbc1dda3e9395493f39695995ef690f1a3ff631c9b6
6
+ metadata.gz: 5a1ed3ae0bc7f231d84c01913e012eb46a32ff5020d26f43a88b0c3875a923901f8ebb6992a2b13e7c83400beadeee636aa8450d1a216563d968206cff7fc5f0
7
+ data.tar.gz: 09409b8f6460607cbb64140439f878e635926e51e10941860ce60217b66618b1622e0f137cf8a2890f44d012ac74ee2394666a46594bda5506451344a919b155
@@ -2,6 +2,9 @@
2
2
  LineLength:
3
3
  Max: 100
4
4
 
5
+ ClassLength:
6
+ Max: 103
7
+
5
8
  AlignHash:
6
9
  # Alignment of entries using hash rocket as separator. Valid values are:
7
10
  #
@@ -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
@@ -1,3 +1,4 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require 'astrolabe/builder'
4
+ require 'astrolabe/sexp'
@@ -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
@@ -5,8 +5,8 @@ module Astrolabe
5
5
  # http://semver.org/
6
6
  module Version
7
7
  MAJOR = 1
8
- MINOR = 1
9
- PATCH = 0
8
+ MINOR = 2
9
+ PATCH = 1
10
10
 
11
11
  def self.to_s
12
12
  [MAJOR, MINOR, PATCH].join('.')
@@ -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.0
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: