Class: Stenographer::Word

Inherits:
Object
  • Object
show all
Defined in:
lib/stenographer/word.rb

Constant Summary collapse

SWEARWORDS =
File.read('./config/swearwords.txt').split(' ')

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Word

Returns a new instance of Word.



8
9
10
# File 'lib/stenographer/word.rb', line 8

def initialize(text)
  @text = text
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/stenographer/word.rb', line 6

def text
  @text
end

Class Method Details

.split_message(message) ⇒ Object



12
13
14
15
16
17
# File 'lib/stenographer/word.rb', line 12

def self.split_message(message)
  words = message.body.split(" ")
  words = words.map(&:strip)

  words.collect{|text| new(text)}
end