Class: VocabularyToCsv
- Inherits:
-
Object
- Object
- VocabularyToCsv
- Defined in:
- lib/vocabulary_to_csv.rb,
lib/vocabulary_to_csv/version.rb
Overview
Interface to interact with vocabulary.com
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
-
#initialize(id) ⇒ VocabularyToCsv
constructor
A new instance of VocabularyToCsv.
- #parse_and_save_to_csv(examples: true) ⇒ Object
Constructor Details
#initialize(id) ⇒ VocabularyToCsv
Returns a new instance of VocabularyToCsv.
11 12 13 14 |
# File 'lib/vocabulary_to_csv.rb', line 11 def initialize(id) @id = id @url = "https://www.vocabulary.com/lists/#{id}" end |
Instance Method Details
#parse_and_save_to_csv(examples: true) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/vocabulary_to_csv.rb', line 16 def parse_and_save_to_csv(examples: true) words = scrape_words definitions = scrape_definitions examples_data = examples ? scrape_examples : Array.new(words.size, "") write_to_csv(words, definitions, examples_data) end |