javaparse 0.0.7 → 0.0.9
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.
- data/lib/javaparse/java_files.rb +3 -1
- data/lib/javaparse/java_unit.rb +4 -3
- metadata +3 -3
data/lib/javaparse/java_files.rb
CHANGED
@@ -2,6 +2,8 @@ module JavaParse
|
|
2
2
|
|
3
3
|
class JavaFiles
|
4
4
|
|
5
|
+
attr_reader :java_units
|
6
|
+
|
5
7
|
def initialize(*directories)
|
6
8
|
@java_units = []
|
7
9
|
paths = directories.map { |directory|
|
@@ -18,7 +20,7 @@ module JavaParse
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def count(type = :files)
|
21
|
-
return @java_units.inject(0) { |sum, java_unit| sum + java_unit.send(type)} if [:bloc, :cloc, :loc].include? type.to_sym
|
23
|
+
return @java_units.inject(0) { |sum, java_unit| sum + java_unit.send(type)} if [:bloc, :cloc, :loc, :all_lines].include? type.to_sym
|
22
24
|
return @java_units.size if type == :files
|
23
25
|
raise "Do not know how to count type #{type}"
|
24
26
|
end
|
data/lib/javaparse/java_unit.rb
CHANGED
@@ -4,7 +4,7 @@ module JavaParse
|
|
4
4
|
|
5
5
|
class JavaUnit
|
6
6
|
|
7
|
-
attr_reader :body, :head, :loc, :bloc, :cloc
|
7
|
+
attr_reader :body, :head, :loc, :bloc, :cloc, :all_lines
|
8
8
|
|
9
9
|
def initialize(java_file_path)
|
10
10
|
@file_path = java_file_path
|
@@ -39,8 +39,9 @@ module JavaParse
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def count_lines
|
42
|
-
@loc, @bloc, @cloc = 0, 0, 0
|
42
|
+
@all_lines, @loc, @bloc, @cloc = 0, 0, 0, 0
|
43
43
|
@content.each_line { |line|
|
44
|
+
@all_lines += 1
|
44
45
|
if line.strip.empty?
|
45
46
|
@bloc += 1
|
46
47
|
elsif JAVA_COMMENTS_RE.match(line)
|
@@ -49,7 +50,7 @@ module JavaParse
|
|
49
50
|
@loc += 1
|
50
51
|
end
|
51
52
|
}
|
52
|
-
[@loc, @cloc, @bloc]
|
53
|
+
[@loc, @cloc, @bloc, @all_lines]
|
53
54
|
end
|
54
55
|
|
55
56
|
def unit_declaration_line
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: javaparse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -44,5 +44,5 @@ rubyforge_project: javaparse
|
|
44
44
|
rubygems_version: 1.8.24
|
45
45
|
signing_key:
|
46
46
|
specification_version: 3
|
47
|
-
summary:
|
47
|
+
summary: Parsing info from Java files
|
48
48
|
test_files: []
|