sexp_cli_tools 0.1.0 → 0.2.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: 5450748309abadaaf12185fbffbc943f92ffa80b5cb16956c7737ee4dbe5e848
4
- data.tar.gz: dd45f667572f84d72dee8006a61bcf5949b162eff7e40235708097dae8d147df
3
+ metadata.gz: cfd7461cf33cec563afc13f39afaebceaa45dc09fa3eb45218bdc6972b95b306
4
+ data.tar.gz: 36ec4b06baabaf5948db2fc6a1f684de53d7cdab792c10374676163b4282d3f5
5
5
  SHA512:
6
- metadata.gz: ba7cbb70b5e2990444c971b93ac47d9d3086bb41e5974f1a0e28a08c06237c025af84d285ab9b7fe8eaccc92dc484c5a60af0fc0387e0e78057d1988215b1810
7
- data.tar.gz: 1b23f5d3b0a41a95255d9de7496f4e138157d3f8767ed73b1cb260ede47e74b9789e204d908e8a7b1c992ccd35b89708a21770e94fc83b2cf77f85964e8b4b69
6
+ metadata.gz: 1ecf793511ac338cc9c5189b4bb29a99947072d2eb96a02ed1e5710714c4edc15376bf83708eeb802140f5e82d12e248c9329892124531af0733767bb87ef421
7
+ data.tar.gz: d0c51c4cef9bddba9582ff525ce3d699186b881775d619fb310235bce90123cb40db0d6a2b044a8a7c843af680875e6b34110ac0a728e152171c06ff8b065033
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sexp_cli_tools (0.1.0)
4
+ sexp_cli_tools (0.2.0)
5
5
  ruby_parser (~> 3.18.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -18,7 +18,7 @@ Lets imagine a scenario where we have achieved total consensus in an organizatio
18
18
  #### Goal
19
19
 
20
20
  - Replace methods that call super with a hook method
21
- - Modify parent classes implementation of the supered method to call hook methods
21
+ - Modify parent class' implementation of the supered method to call hook methods
22
22
 
23
23
  #### Initial state
24
24
 
@@ -95,6 +95,11 @@ What isn't show in [the commit which added the `Sexp::Matcher`](https://github.c
95
95
 
96
96
  Setting up a unit test can help close that iteration loop. [Consider the unit test for `SexpCliTools::Matchers::SuperCaller`](test/sexp_cli_tools/matchers/super_caller_test.rb)
97
97
 
98
+ Allowing users to experiment with s-expressions might enable exploration and discovery. The `sexp find` command also supports inline s-expressions. Try these in your projects:
99
+
100
+ - `sexp find '(class ___)'` to find class definitions
101
+ - `sexp find '[include (case ___)]'` to find case statements
102
+
98
103
  #### Hook methods from super callers
99
104
 
100
105
  #### Hook calls from super methods
@@ -10,7 +10,7 @@ module SexpCliTools
10
10
 
11
11
  desc "find sexp-matcher [**/*.rb]", "Finds Ruby files matching the s-expression matcher in the glob pattern. Defaults to search all Ruby files with the pattern **/*.rb"
12
12
  def find(requested_sexp_matcher, glob="**/*.rb")
13
- sexp_matcher = SexpCliTools::MATCHERS.fetch(requested_sexp_matcher)
13
+ sexp_matcher = SexpCliTools::MATCHERS[requested_sexp_matcher]
14
14
  Pathname.glob(glob).each do |path|
15
15
  puts path.to_s if sexp_matcher.satisfy?(RubyParser.new.parse(path.read))
16
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SexpCliTools
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -8,9 +8,11 @@ require_relative "sexp_cli_tools/matchers/super_caller"
8
8
  module SexpCliTools
9
9
  class Error < StandardError; end
10
10
 
11
- MATCHERS = {
12
- "child-class" => Sexp::Matcher.parse('(class _ (const _) ___)'),
13
- "parent-class" => Sexp::Matcher.parse('(class _ [not? (const _)] ___)'),
14
- "super-caller" => Matchers::SuperCaller,
15
- }.freeze
11
+ MATCHERS = Hash
12
+ .new {|hash, key| hash[key] = Sexp::Matcher.parse(key) }
13
+ .merge({
14
+ "child-class" => Sexp::Matcher.parse('(class _ (const _) ___)'),
15
+ "parent-class" => Sexp::Matcher.parse('(class _ [not? (const _)] ___)'),
16
+ "super-caller" => Matchers::SuperCaller,
17
+ })
16
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sexp_cli_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Buxton