Class: Mangdown::MangaList
- Inherits:
-
Object
- Object
- Mangdown::MangaList
- Defined in:
- lib/mangdown/manga_list.rb
Overview
a list of manga
Instance Attribute Summary collapse
-
#mangas ⇒ Object
readonly
Returns the value of attribute mangas.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*uri, mangas: []) ⇒ MangaList
constructor
A new instance of MangaList.
- #to_yaml ⇒ Object
Constructor Details
#initialize(*uri, mangas: []) ⇒ MangaList
12 13 14 15 16 17 18 19 |
# File 'lib/mangdown/manga_list.rb', line 12 def initialize(*uri, mangas: []) @mangas = mangas if mangas.empty? uri.each {|uri| get_mangas(uri)} else @mangas.map! { |hash| MDHash.new(hash) } end end |
Instance Attribute Details
#mangas ⇒ Object (readonly)
Returns the value of attribute mangas.
6 7 8 |
# File 'lib/mangdown/manga_list.rb', line 6 def mangas @mangas end |
Class Method Details
.from_data(mangas) ⇒ Object
8 9 10 |
# File 'lib/mangdown/manga_list.rb', line 8 def self.from_data(mangas) new(nil, mangas: mangas) end |
Instance Method Details
#to_yaml ⇒ Object
21 22 23 |
# File 'lib/mangdown/manga_list.rb', line 21 def to_yaml @mangas.map(&:to_hash).to_yaml end |