Class: CodeStats::FileSet
- Inherits:
-
Object
- Object
- CodeStats::FileSet
- Defined in:
- lib/code_stats/file_set.rb
Constant Summary collapse
- AVAILIABLE_OPTIONS =
[:only, :except]
Instance Method Summary collapse
- #add(script) ⇒ Object
- #characters_count(options = {}) ⇒ Object
- #characters_count_by_language(options = {}) ⇒ Object
-
#initialize ⇒ FileSet
constructor
A new instance of FileSet.
- #lines_count(options = {}) ⇒ Object
- #lines_count_by_language(options = {}) ⇒ Object
Constructor Details
#initialize ⇒ FileSet
Returns a new instance of FileSet.
2 3 4 |
# File 'lib/code_stats/file_set.rb', line 2 def initialize @lines_count_by_language, @characters_count_by_language = Hash.new(0), Hash.new(0) end |
Instance Method Details
#add(script) ⇒ Object
26 27 28 29 |
# File 'lib/code_stats/file_set.rb', line 26 def add script @lines_count_by_language[script.class.alias.to_sym] += script.lines_count @characters_count_by_language[script.class.alias.to_sym] += script.characters_count end |
#characters_count(options = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/code_stats/file_set.rb', line 12 def characters_count = {} total_count = 0 characters_count_by_language().each{|lang, count| total_count += count} total_count end |
#characters_count_by_language(options = {}) ⇒ Object
22 23 24 |
# File 'lib/code_stats/file_set.rb', line 22 def characters_count_by_language = {} filter_by_lang(@characters_count_by_language, ) end |
#lines_count(options = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/code_stats/file_set.rb', line 6 def lines_count = {} total_count = 0 lines_count_by_language().each{|lang, count| total_count += count} total_count end |
#lines_count_by_language(options = {}) ⇒ Object
18 19 20 |
# File 'lib/code_stats/file_set.rb', line 18 def lines_count_by_language = {} filter_by_lang(@lines_count_by_language, ) end |