Class: Camdict::Explanation::Sentence

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/camdict/explanation.rb

Overview

Parse the html to get the example sentence and its typical usage information associated with this sentence.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Sentence

New a sentence object from html containing the eg block.



106
107
108
109
110
# File 'lib/camdict/explanation.rb', line 106

def initialize(html)
  @html = html
  @usage = get_usage
  @sentence = get_sentence
end

Instance Attribute Details

#sentenceObject (readonly)

Get one sentence inside an example block.



103
104
105
# File 'lib/camdict/explanation.rb', line 103

def sentence
  @sentence
end

#usageObject (readonly)

Get the grammar code or usage in this sentence. It means how the word is used in this sentence. For example, a grammar code for the word - ‘somewhere’ is “+to infinitive”. I’m looking for somewhere to eat.



100
101
102
# File 'lib/camdict/explanation.rb', line 100

def usage
  @usage
end