meta_commit_ruby_support 0.1.1 → 0.1.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f6651c9215681da501c4b94a0cb695c8de35466
|
4
|
+
data.tar.gz: 58d6f2085ed48638bcd21924b9a67c4412b0db75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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
|
-
|
15
|
-
|
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
|
-
|
49
|
+
type == :module
|
46
50
|
end
|
47
51
|
|
48
52
|
# @return [Boolean]
|
49
53
|
def is_class?
|
50
|
-
|
54
|
+
type == :class
|
51
55
|
end
|
52
56
|
|
53
57
|
# @return [Boolean]
|
54
58
|
def is_method?
|
55
|
-
|
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]
|
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.
|
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-
|
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
|