haml_lint 0.40.0 → 0.40.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
  SHA256:
3
- metadata.gz: 8ef9ca7cc6bbd3b5f9663a2bda75669062b25efeb53af9e32cf152fd7f5aee6c
4
- data.tar.gz: 35e34d39d55e13910ec90f9ee7ece9a4baa2d6bc44f2f6962b230f6387519174
3
+ metadata.gz: 1655e5263c92bb0a391c1e56aea103792409f17a72deafb16818844fd5f6d7c8
4
+ data.tar.gz: 65d4539637d4caf656940041040ad33227a0d89eb923207fb5fedafcf357f0bd
5
5
  SHA512:
6
- metadata.gz: 376df9f9c0de3c0949bd2187bb1ba9f3bc5e381644a93c827ca085125ac2922f59f98d048d8bf548b379ebe5def5180f9b182628030f4e66454f3edf71478f9f
7
- data.tar.gz: fa1a9ad202224e1059dd7802b1aea08db8b9d11570feca891a31650dc3b10f0b991b2585ad27faa4425bc2165a2b23e799075c944250a43568e1d17c7f83f8b1
6
+ metadata.gz: 1f08f1952a5a9ab8adc6b5c6730ec0a441ccdc10ac1a59922f77bc54c74fc95db3b49e732400aef960c4bae7581950fb21874e78d3b516e22d5cc61dc914da72
7
+ data.tar.gz: 91af5862db990bc021c1088b0de462f5f3a84ad7509cc62498ee4ac70a11f05b423d7778deead53da353253f38d76d5c84cde5417d1da3ac43bccc23f16a4753
@@ -9,7 +9,13 @@ module HamlLint::Tree
9
9
  #
10
10
  # @return [ParsedRuby] syntax tree in the form returned by Parser gem
11
11
  def parsed_script
12
- HamlLint::ParsedRuby.new(HamlLint::RubyParser.new.parse(script))
12
+ statement =
13
+ if children.empty?
14
+ script
15
+ else
16
+ "#{script}#{@value[:keyword] == 'case' ? ';when 0;end' : ';end'}"
17
+ end
18
+ HamlLint::ParsedRuby.new(HamlLint::RubyParser.new.parse(statement))
13
19
  end
14
20
 
15
21
  # Returns the source for the script following the `-` marker.
@@ -8,7 +8,22 @@ module HamlLint::Tree
8
8
  #
9
9
  # @return [ParsedRuby] syntax tree in the form returned by Parser gem
10
10
  def parsed_script
11
- HamlLint::ParsedRuby.new(HamlLint::RubyParser.new.parse(script))
11
+ statement =
12
+ case keyword = @value[:keyword]
13
+ when 'else', 'elsif'
14
+ 'if 0;' + script + ';end'
15
+ when 'when'
16
+ 'case;' + script + ';end'
17
+ when 'rescue', 'ensure'
18
+ 'begin;' + script + ';end'
19
+ else
20
+ if children.empty?
21
+ script
22
+ else
23
+ "#{script}#{keyword == 'case' ? ';when 0;end' : ';end'}"
24
+ end
25
+ end
26
+ HamlLint::ParsedRuby.new(HamlLint::RubyParser.new.parse(statement))
12
27
  end
13
28
 
14
29
  # Returns the source for the script following the `-` marker.
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module HamlLint
5
- VERSION = '0.40.0'
5
+ VERSION = '0.40.1'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.0
4
+ version: 0.40.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-27 00:00:00.000000000 Z
11
+ date: 2022-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml