Class: SmTranscript::Word

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_time, end_time, word) ⇒ Word

Returns a new instance of Word.



11
12
13
14
15
# File 'lib/sm_transcript/word.rb', line 11

def initialize( start_time, end_time, word )
  @start_time = start_time
  @end_time = end_time
  @word = apply_word_rules(word)
end

Instance Attribute Details

#end_timeObject (readonly)

Returns the value of attribute end_time.



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

def end_time
  @end_time
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



7
8
9
# File 'lib/sm_transcript/word.rb', line 7

def start_time
  @start_time
end

#wordObject (readonly)

Returns the value of attribute word.



9
10
11
# File 'lib/sm_transcript/word.rb', line 9

def word
  @word
end

Instance Method Details

#apply_word_rules(word) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sm_transcript/word.rb', line 17

def apply_word_rules(word)
  case word
  when "i" # (English) "i" appearing as a word is capitalized
    word.upcase
  when "i'm", "i've" # (English) "i" as personal pronoun is capitalized
    word.capitalize
  when "iranian"  # (English) proper nouns are capitalized
    word.capitalize
  else
    word
  end
end