Class: Mangdown::PopularManga

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Equality
Defined in:
lib/mangdown/popular.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Equality

#<=>, #==, #eql?

Constructor Details

#initialize(uri, num_mangas = 30, name = "My Pop Manga") ⇒ PopularManga



8
9
10
11
12
13
14
15
# File 'lib/mangdown/popular.rb', line 8

def initialize(uri, num_mangas = 30, name = "My Pop Manga")
  @uri        = uri 
  @num_mangas = num_mangas
  @name       = name
  @mangas     = []

  get_mangas_list
end

Instance Attribute Details

#mangasObject (readonly)

Returns the value of attribute mangas.



6
7
8
# File 'lib/mangdown/popular.rb', line 6

def mangas
  @mangas
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/mangdown/popular.rb', line 6

def name
  @name
end

#uriObject (readonly)

Returns the value of attribute uri.



6
7
8
# File 'lib/mangdown/popular.rb', line 6

def uri
  @uri
end

Instance Method Details

#eachObject

iterate over mangas (for enumerable)



18
19
20
# File 'lib/mangdown/popular.rb', line 18

def each
  @mangas.each {|manga| yield(manga) if block_given?}
end