leftovers 0.5.0 → 0.5.1

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
- SHA256:
3
- metadata.gz: d666abea8ce822697d18bd1b07a31684e7e85b81d3e3184c097438f0f83d89f5
4
- data.tar.gz: 16c80ab37e2073f7738e40f8db24c628d688d9640cc5c00d0864d5da4f207bb6
2
+ SHA1:
3
+ metadata.gz: 03a9797868cc444642bc0d475de4bd067a344891
4
+ data.tar.gz: fa5961bbcbb420c1a4a1159215e5df64da163b71
5
5
  SHA512:
6
- metadata.gz: f57aa2dc36e1c980a05afb8a4feb156f34a5a91b2486713d118d161b41f164c0afc73e05fc79dc693b550a14a17e4510ac57a0be84b6c97cc6e5f3df29b940c3
7
- data.tar.gz: 9aa8746deda0bc64cdd2c9f476396d7e01859cf81ebbdf982fbab484bfde0c0d14e9dbc636bb5c5fab3a46119fab4531424e3cbdcf4ac3dc71a043eb671e6808
6
+ metadata.gz: 5c6d93694df1819e9f464b184b64ebb4ce53fe8b73558c59e286d21fae4d349bed14e89c57c4f6f7c38a7c8ec51669cd6ab909d09f6ec7384f197725846c5092
7
+ data.tar.gz: 2955b7635cf34fccbaa06e3555ec0210a2a9fc00afa116c7a9e412d703c22a6ad3e563021ace19fec7cd96d13ec5d3222515355f0794a39206deab64ac1297bb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # v0.5.1
2
+ - fixed a bug with the erb parsing where it was incorrectly compiling comments:
3
+ ```
4
+ <% # Comment %>
5
+ <% if query? %>
6
+ <%= content %>
7
+ <% end %>
8
+ ```
9
+
1
10
  # v0.5.0
2
11
  - `has_receiver:` will match the receiver for methods and the namespace for constants.
3
12
  - `has_value_type:` is now `has_value: type:`
data/lib/leftovers/erb.rb CHANGED
@@ -10,11 +10,11 @@ module Leftovers
10
10
  end
11
11
 
12
12
  def add_insert_cmd(out, content) # leftovers:keep
13
- out.push("#{content}\n")
13
+ out.push("\n#{content}\n")
14
14
  end
15
15
 
16
16
  def add_put_cmd(out, _content) # leftovers:keep
17
- out
17
+ out.push("\n")
18
18
  end
19
19
  end
20
20
  end
@@ -12,7 +12,7 @@ module Leftovers
12
12
  when ::String
13
13
  ::Leftovers::MatcherBuilders::NodeName.build(pat)
14
14
  when ::Hash
15
- build_from_hash(pat)
15
+ build_from_hash(**pat)
16
16
  # :nocov:
17
17
  else raise
18
18
  # :nocov:
@@ -22,18 +22,26 @@ module Leftovers
22
22
 
23
23
  private
24
24
 
25
- def build_from_hash(pat) # rubocop:disable Metrics/MethodLength
25
+ def build_from_hash( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
26
+ at: nil, has_value: nil,
27
+ match: nil, has_prefix: nil, has_suffix: nil,
28
+ type: nil,
29
+ has_receiver: nil,
30
+ unless_arg: nil
31
+ )
26
32
  matcher = ::Leftovers::MatcherBuilders::And.build([
27
- ::Leftovers::MatcherBuilders::NodeHasArgument.build(pat.slice(:at, :has_value)),
33
+ ::Leftovers::MatcherBuilders::NodeHasArgument.build(
34
+ at: at, has_value: has_value
35
+ ),
28
36
  ::Leftovers::MatcherBuilders::NodeName.build(
29
- pat.slice(:match, :has_prefix, :has_suffix)
37
+ match: match, has_prefix: has_prefix, has_suffix: has_suffix
30
38
  ),
31
- ::Leftovers::MatcherBuilders::NodeType.build(pat[:type]),
32
- ::Leftovers::MatcherBuilders::NodeHasReceiver.build(pat[:has_receiver])
39
+ ::Leftovers::MatcherBuilders::NodeType.build(type),
40
+ ::Leftovers::MatcherBuilders::NodeHasReceiver.build(has_receiver)
33
41
  ])
34
42
 
35
43
  ::Leftovers::MatcherBuilders::AndNot.build(
36
- matcher, ::Leftovers::MatcherBuilders::NodeValue.build(pat[:unless_arg])
44
+ matcher, ::Leftovers::MatcherBuilders::NodeValue.build(unless_arg)
37
45
  )
38
46
  end
39
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leftovers
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leftovers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dana Sherson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-25 00:00:00.000000000 Z
11
+ date: 2021-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -465,7 +465,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
465
465
  - !ruby/object:Gem::Version
466
466
  version: '0'
467
467
  requirements: []
468
- rubygems_version: 3.1.6
468
+ rubyforge_project:
469
+ rubygems_version: 2.6.13
469
470
  signing_key:
470
471
  specification_version: 4
471
472
  summary: Find unused methods and classes/modules