meta_commit_ruby_support 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 7767dc4aa3694060d8171d3f3e3dfc3f8c2894e0
4
- data.tar.gz: 0caf9b1a78f4eb5f3525dbbc37cfd74c487b84ab
3
+ metadata.gz: 4f6651c9215681da501c4b94a0cb695c8de35466
4
+ data.tar.gz: 58d6f2085ed48638bcd21924b9a67c4412b0db75
5
5
  SHA512:
6
- metadata.gz: c045b634d67c11488f3398b308399d5ec110a474d4e1d53b017ff1afaea11fe1beb319d03fca1b9e6219bc9b16b1dd96bb58c90e80fa27a667c28723665eb8d2
7
- data.tar.gz: 30b4143b17d08876aaf2cd2d4bd2fbe82f7011d02428c8e65910c10ff20c5f2694bc19bc3f9744538c7fa84c701702923199a5ec731ee6eee365bee7676ad2ad
6
+ metadata.gz: bb6a3110e4bce6ff8f89c10f2a7130412cdf9f68397e990dace7674c6f4ebdaa2880712bd7b18b31e44e9598509f50253ea00bb43d3fcac6ba17ab09f4287286
7
+ data.tar.gz: 0bd5d942d35b1bf057df970726c9509b583ef05fa51efa945d58b585bac1a63eb7a77684fa53703f1acfd8c0b99ecace310c01a4c824be18fb6a5e15fe9428c9
@@ -15,13 +15,13 @@ module MetaCommit::Extension::RubySupport::Helpers
15
15
  # on created class only first line goes to diff
16
16
  # @param [MetaCommit::Model::ContextualAstNode] ast
17
17
  def is_name_of_class?(ast)
18
- (ast.target_node.ast.type == :const) and (ast.context_nodes.length > 1) and (ast.context_nodes[ast.context_nodes.length - 1 - 1].ast.type == :class)
18
+ (ast.target_node.type == :const) and (ast.context_nodes.length > 1) and (ast.context_nodes[ast.context_nodes.length - 1 - 1].type == :class)
19
19
  end
20
20
 
21
21
  # on created module only first line goes to diff
22
22
  # @param [MetaCommit::Model::ContextualAstNode] ast
23
23
  def is_name_of_module?(ast)
24
- (ast.target_node.ast.type == :const) and (ast.context_nodes.length > 1) and (ast.context_nodes[ast.context_nodes.length - 1 - 1].ast.type == :module)
24
+ (ast.target_node.type == :const) and (ast.context_nodes.length > 1) and (ast.context_nodes[ast.context_nodes.length - 1 - 1].type == :module)
25
25
  end
26
26
 
27
27
  # @param [MetaCommit::Model::ContextualAstNode] ast
@@ -11,8 +11,12 @@ module MetaCommit::Extension::RubySupport::Models
11
11
 
12
12
  # @return [Array<MetaCommit::Contracts::Ast>]
13
13
  def children
14
- @ast.children
15
- .map {|child| Ast.new(child)}
14
+ begin
15
+ @ast.children
16
+ .map {|child| Ast.new(child)}
17
+ rescue NoMethodError
18
+ return []
19
+ end
16
20
  end
17
21
 
18
22
  # @return [Integer]
@@ -42,17 +46,23 @@ module MetaCommit::Extension::RubySupport::Models
42
46
 
43
47
  # @return [Boolean]
44
48
  def is_module?
45
- @ast.type == :module
49
+ type == :module
46
50
  end
47
51
 
48
52
  # @return [Boolean]
49
53
  def is_class?
50
- @ast.type == :class
54
+ type == :class
51
55
  end
52
56
 
53
57
  # @return [Boolean]
54
58
  def is_method?
55
- @ast.type == :def
59
+ type == :def
60
+ end
61
+
62
+ # @return [Symbol]
63
+ def type
64
+ return @ast.class.to_s.to_sym unless @ast.respond_to?(:type)
65
+ @ast.type
56
66
  end
57
67
 
58
68
  # @return [String]
@@ -1,7 +1,7 @@
1
1
  module MetaCommit
2
2
  module Extension
3
3
  module RubySupport
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_commit_ruby_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav Dobrovolskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-04 00:00:00.000000000 Z
11
+ date: 2018-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: meta_commit_contracts