Module: TextAnalysis

Defined in:
lib/text_analysis.rb,
lib/text_analysis/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.analyze_text(text_input) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/text_analysis.rb', line 4

def self.analyze_text(text_input)
  hash = {}

  hash[:total_characters] = text_input.length
  hash[:total_characters_without_whitespaces] = text_input.gsub(/\s+/, "").length
  hash[:total_words] = text_input.split(/[\w-]+/).size

  hash
end