erb_lint 0.0.33 → 0.0.34

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: a3ff806639308ae7fadb9ef9f288756d7262c55b20ad2a0313f68b9b7e20f6a2
4
- data.tar.gz: 8fc39ebbdecf81dce1c8fc10aca32442c1362e09720050b1d468c2346bf3aee2
3
+ metadata.gz: 65e35ea36e2654316241c7267aca2f9b581fa7eb5c858008a80dfc098c07a187
4
+ data.tar.gz: db35c2f60f85651728bec14a853fc8d7060e93e686c9cababa55bccb3dd46c49
5
5
  SHA512:
6
- metadata.gz: 54df4cd99ddf995bbdbb91c17f8630bc37f2aaa604f1f63ddb4b91cadd78f2c9091622ef863302bdf44bc0bcd9ab568b845fca46573e0e0d71a15979f5f38aae
7
- data.tar.gz: d515114cac11924e604198eec988d61681cf61090f9cf52ab5e2c20896bda4a5f908fb014efe9d601c09107064f5f335e6a6cc553b15ea2733eb5024e1fbbc09
6
+ metadata.gz: dbe12716e085e0baa6beef5c1395bf86874f442db6087c2d1312315cb4d60704cca5a007a3843738197d58fa0025d35b993bbbed5606ca9a3c71b81928d365e2
7
+ data.tar.gz: 7bb3506036e3a098cb9c688c20373a80bc413a6528fcb05b951e16996dd62eea358c01658f5b2aceb4d4b1b4bc63afa7ad53d852478b2b49d549a13f3da6ed1c
@@ -38,7 +38,9 @@ module ERBLint
38
38
  @corrector.remove_trailing(range_with_offset(range), size)
39
39
  end
40
40
 
41
- def range_with_offset(range)
41
+ def range_with_offset(node_or_range)
42
+ range = to_range(node_or_range)
43
+
42
44
  @processed_source.to_source_range(
43
45
  bound(@offset + range.begin_pos)..bound(@offset + (range.end_pos - 1))
44
46
  )
@@ -50,6 +52,21 @@ module ERBLint
50
52
  @bound_range.max,
51
53
  ].min
52
54
  end
55
+
56
+ private
57
+
58
+ def to_range(node_or_range)
59
+ case node_or_range
60
+ when ::RuboCop::AST::Node, ::Parser::Source::Comment
61
+ node_or_range.loc.expression
62
+ when ::Parser::Source::Range
63
+ node_or_range
64
+ else
65
+ raise TypeError,
66
+ 'Expected a Parser::Source::Range, Comment or ' \
67
+ "Rubocop::AST::Node, got #{node_or_range.class}"
68
+ end
69
+ end
53
70
  end
54
71
  end
55
72
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ERBLint
4
- VERSION = '0.0.33'
4
+ VERSION = '0.0.34'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erb_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33
4
+ version: 0.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Chan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-21 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_html