Class: Camdict::Explanation
- Inherits:
-
Object
- Object
- Camdict::Explanation
- Includes:
- Common
- Defined in:
- lib/camdict/explanation.rb
Overview
Explanation are inside the def-block node.
Defined Under Namespace
Classes: Sentence
Instance Attribute Summary collapse
-
#examples ⇒ Object
readonly
Get example sentences.
-
#gc ⇒ Object
readonly
Grammar code.
-
#level ⇒ Object
readonly
Elementary level.
-
#meaning ⇒ Object
readonly
A meaning of the word.
-
#opposite ⇒ Object
readonly
Get opposite word.
-
#region ⇒ Object
readonly
The meaning is used in which region - UK or US.
-
#synonym ⇒ Object
readonly
Get synonym word.
-
#usage ⇒ Object
readonly
One or two words usage note.
-
#variant ⇒ Object
readonly
For a specific explanation, the word may have a variant form.
Instance Method Summary collapse
-
#initialize(html) ⇒ Explanation
constructor
Parse
htmlto get level, meaning, example sentences, synonym, opposite, usage, grammar code, region, variant.
Constructor Details
#initialize(html) ⇒ Explanation
Parse html to get level, meaning, example sentences, synonym, opposite, usage, grammar code, region, variant.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/camdict/explanation.rb', line 40 def initialize(html) @html = html @level = get_level # String @variant = get_variant # String @meaning = get_meaning # String @gc = css_text(".gcs") # String @usage = css_text(".usage") # String @region = css_text(".region") # String @examples = get_examples # [Sentence] @synonym = get_synonym # String @opposite = get_opposite # String # todo: add usage panel - the word: somewhere. end |
Instance Attribute Details
#examples ⇒ Object (readonly)
Get example sentences
15 16 17 |
# File 'lib/camdict/explanation.rb', line 15 def examples @examples end |
#gc ⇒ Object (readonly)
Grammar code. Full list is dictionary.cambridge.org/help/codes.html
36 37 38 |
# File 'lib/camdict/explanation.rb', line 36 def gc @gc end |
#level ⇒ Object (readonly)
Elementary level. It’s a symbol indicating the level when learnders know this meaning.
A1: Beginner, A2: Elementary,
B1: Intermediate, B2: Upper-Intermediate,
C1: Advanced, C2: Proficiency
12 13 14 |
# File 'lib/camdict/explanation.rb', line 12 def level @level end |
#meaning ⇒ Object (readonly)
A meaning of the word
24 25 26 |
# File 'lib/camdict/explanation.rb', line 24 def meaning @meaning end |
#opposite ⇒ Object (readonly)
Get opposite word
21 22 23 |
# File 'lib/camdict/explanation.rb', line 21 def opposite @opposite end |
#region ⇒ Object (readonly)
The meaning is used in which region - UK or US.
30 31 32 |
# File 'lib/camdict/explanation.rb', line 30 def region @region end |
#synonym ⇒ Object (readonly)
Get synonym word
18 19 20 |
# File 'lib/camdict/explanation.rb', line 18 def synonym @synonym end |
#usage ⇒ Object (readonly)
One or two words usage note. For example, slang.
27 28 29 |
# File 'lib/camdict/explanation.rb', line 27 def usage @usage end |
#variant ⇒ Object (readonly)
For a specific explanation, the word may have a variant form.
33 34 35 |
# File 'lib/camdict/explanation.rb', line 33 def variant @variant end |