Module: PageSpecification

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

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.count_words(text) ⇒ Object



2
3
4
5
# File 'lib/page_specification/page_specification.rb', line 2

def self.count_words(text)
  words = text.split(" ")
  words.count
end

.count_world(text, string) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/page_specification/page_specification.rb', line 7

def self.count_world(text, string)
  worlds = text.split(" ")
  count = 0

  worlds.each do |w|
    if (w == string) 
      count += 1
    end
  end
  count
end