javaparse 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module JavaParse
2
2
 
3
3
  class JavaFiles
4
4
 
5
- attr_reader :java_units
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
@@ -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.9
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-09 00:00:00.000000000 Z
12
+ date: 2012-08-12 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: