Class: RailsAppSourceMetrics
- Inherits:
-
Object
- Object
- RailsAppSourceMetrics
- Defined in:
- lib/rails_app_source_metrics.rb
Constant Summary collapse
- CODE_SECTIONS =
[ { :name => "Controllers", :directory => "app/controllers/" }, { :name => "Helpers", :directory => "app/helpers/" }, { :name => "Models", :directory => "app/models/" }, { :name => "Libraries", :directory => "lib/" }, { :name => "Integration Tests", :directory => "test/integration/" }, { :name => "Functional Tests", :directory => "test/functional/" }, { :name => "Unit Tests", :directory => "test/unit/" } ]
Instance Attribute Summary collapse
-
#code_sections ⇒ Object
readonly
Returns the value of attribute code_sections.
-
#code_to_test_ratio ⇒ Object
readonly
Returns the value of attribute code_to_test_ratio.
-
#lines_of_code ⇒ Object
readonly
Returns the value of attribute lines_of_code.
-
#lines_of_test_code ⇒ Object
readonly
Returns the value of attribute lines_of_test_code.
-
#totals ⇒ Object
readonly
Returns the value of attribute totals.
Instance Method Summary collapse
-
#initialize ⇒ RailsAppSourceMetrics
constructor
A new instance of RailsAppSourceMetrics.
Constructor Details
#initialize ⇒ RailsAppSourceMetrics
Returns a new instance of RailsAppSourceMetrics.
16 17 18 19 20 21 22 23 |
# File 'lib/rails_app_source_metrics.rb', line 16 def initialize @code_sections = CODE_SECTIONS @code_sections.each do |section| source_stats = DirectorySourceStats.new(File.join(Rails.root, section[:directory])) section[:stats] = add_metrics_to_stats(source_stats.get_stats) end calculate_totals end |
Instance Attribute Details
#code_sections ⇒ Object (readonly)
Returns the value of attribute code_sections.
14 15 16 |
# File 'lib/rails_app_source_metrics.rb', line 14 def code_sections @code_sections end |
#code_to_test_ratio ⇒ Object (readonly)
Returns the value of attribute code_to_test_ratio.
14 15 16 |
# File 'lib/rails_app_source_metrics.rb', line 14 def code_to_test_ratio @code_to_test_ratio end |
#lines_of_code ⇒ Object (readonly)
Returns the value of attribute lines_of_code.
14 15 16 |
# File 'lib/rails_app_source_metrics.rb', line 14 def lines_of_code @lines_of_code end |
#lines_of_test_code ⇒ Object (readonly)
Returns the value of attribute lines_of_test_code.
14 15 16 |
# File 'lib/rails_app_source_metrics.rb', line 14 def lines_of_test_code @lines_of_test_code end |
#totals ⇒ Object (readonly)
Returns the value of attribute totals.
14 15 16 |
# File 'lib/rails_app_source_metrics.rb', line 14 def totals @totals end |