Class: Datasets::LivedoorNews
- Includes:
- TarGzReadable
- Defined in:
- lib/datasets/livedoor-news.rb
Defined Under Namespace
Classes: Record
Instance Attribute Summary
Attributes inherited from Dataset
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(type: :topic_news) ⇒ LivedoorNews
constructor
A new instance of LivedoorNews.
Methods included from TarGzReadable
Methods inherited from Dataset
Constructor Details
#initialize(type: :topic_news) ⇒ LivedoorNews
Returns a new instance of LivedoorNews.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/datasets/livedoor-news.rb', line 11 def initialize(type: :topic_news) news_list = [ :topic_news, :sports_watch, :it_life_hack, :kaden_channel, :movie_enter, :dokujo_tsushin, :smax, :livedoor_homme, :peachy ] unless news_list.include?(type) valid_type_labels = news_list.collect(&:inspect).join(", ") = ":type must be one of [#{valid_type_labels}]: #{type.inspect}" raise ArgumentError, end super() @type = type .id = 'livedoor-news' .name = 'livedoor-news' .url = 'https://www.rondhuit.com/download.html#ldcc' .licenses = ['CC-BY-ND-2.1-JP'] .description = lambda do fetch_readme end end |
Instance Method Details
#each(&block) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/datasets/livedoor-news.rb', line 40 def each(&block) return to_enum(__method__) unless block_given? data_path = download_tar_gz parse_data(data_path, &block) end |