Class: CodeStats::Languages::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/code_stats/languages.rb

Direct Known Subclasses

CoffeeScript, Cpp, Erb, Haml, Java, JavaScript, Php, Python, Rjs, Ruby, Yaml

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Abstract

Returns a new instance of Abstract.



5
6
7
# File 'lib/code_stats/languages.rb', line 5

def initialize text
  @text = text
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/code_stats/languages.rb', line 3

def text
  @text
end

Class Method Details

.extensions(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/code_stats/languages.rb', line 9

def self.extensions *args
  if args.size > 0
    @extensions = args
    
    @extensions.each{|ext| CodeStats.extensions[ext] = self}
  else
    @extensions ||= []
  end
end

Instance Method Details

#analyzeObject



29
30
31
# File 'lib/code_stats/languages.rb', line 29

def analyze
  calculate_basic_statistics
end

#characters_countObject



24
25
26
27
# File 'lib/code_stats/languages.rb', line 24

def characters_count
  calculate_basic_statistics
  @characters_count
end

#lines_countObject



19
20
21
22
# File 'lib/code_stats/languages.rb', line 19

def lines_count
  calculate_basic_statistics
  @lines_count
end