javaparse 0.0.9 → 0.1.0
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 +5 -1
- data/lib/javaparse/java_unit.rb +2 -1
- metadata +2 -2
data/lib/javaparse/java_files.rb
CHANGED
@@ -2,7 +2,7 @@ module JavaParse
|
|
2
2
|
|
3
3
|
class JavaFiles
|
4
4
|
|
5
|
-
|
5
|
+
include Enumerable
|
6
6
|
|
7
7
|
def initialize(*directories)
|
8
8
|
@java_units = []
|
@@ -19,6 +19,10 @@ module JavaParse
|
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
22
|
+
def each
|
23
|
+
@java_units.each { |unit| yield unit }
|
24
|
+
end
|
25
|
+
|
22
26
|
def count(type = :files)
|
23
27
|
return @java_units.inject(0) { |sum, java_unit| sum + java_unit.send(type)} if [:bloc, :cloc, :loc, :all_lines].include? type.to_sym
|
24
28
|
return @java_units.size if type == :files
|
data/lib/javaparse/java_unit.rb
CHANGED
@@ -4,10 +4,11 @@ module JavaParse
|
|
4
4
|
|
5
5
|
class JavaUnit
|
6
6
|
|
7
|
-
attr_reader :body, :head, :loc, :bloc, :cloc, :all_lines
|
7
|
+
attr_reader :file_name, :body, :head, :loc, :bloc, :cloc, :all_lines
|
8
8
|
|
9
9
|
def initialize(java_file_path)
|
10
10
|
@file_path = java_file_path
|
11
|
+
@file_name = File.basename(java_file_path)
|
11
12
|
@unit_name = File.basename(java_file_path, ".java")
|
12
13
|
@content = File.open(@file_path) { |file| file.read }
|
13
14
|
validate_unit
|
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.1.0
|
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-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|