Class: ANN_Manga

Inherits:
ANN_Media show all
Defined in:
lib/ann_wrapper/ann_manga.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ANN_Media

#alt_titles, #create_methods, #genres, #images, #synopsis, #themes, #title, #vintage

Constructor Details

#initialize(ann_manga) ⇒ ANN_Manga

Returns a new instance of ANN_Manga.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ann_wrapper/ann_manga.rb', line 7

def initialize(ann_manga)
	@ann_manga = ann_manga

	# information available from detail
	@info = Hash.new
	@info[:title]         			= "Main title"
	@info[:synopsis]      			= "Plot Summary"
	@info[:genres]        			= "Genres"
	@info[:vintage]       			= "Vintage"
	@info[:themes]        			= "Themes"
	@info[:num_tankoubon] = "Number of tankoubon"
	@info[:num_pages]						= "Number of pages"

	# create methods
	create_methods(@ann_manga, @info)
end

Instance Attribute Details

#ann_manga=(value) ⇒ Object (writeonly)

ann_anime Nokogiri object



5
6
7
# File 'lib/ann_wrapper/ann_manga.rb', line 5

def ann_manga=(value)
  @ann_manga = value
end

Instance Method Details

#find_info(key) ⇒ Nokogiri::XML::NodeSet

Return all info with provided key

Returns:

  • (Nokogiri::XML::NodeSet)

    return all info with provided key



25
26
27
# File 'lib/ann_wrapper/ann_manga.rb', line 25

def find_info(key)
	super(@ann_manga, key)
end

#idString

Returns manga id

Returns:

  • (String)

    returns manga id



30
31
32
# File 'lib/ann_wrapper/ann_manga.rb', line 30

def id
	@id ||= @ann_manga['id']
end

#num_pages[String]

Returns the number of tankoubon

Returns:

  • ([String])

    returns the number of tankoubon



62
# File 'lib/ann_wrapper/ann_manga.rb', line 62

def num_pages; end

#num_tankoubon[String]

Returns the number of tankoubon

Returns:

  • ([String])

    returns the number of tankoubon



59
# File 'lib/ann_wrapper/ann_manga.rb', line 59

def num_tankoubon; end

#ratings[ANN_Rating]

Returns array of ANN_Episode

Returns:



45
46
47
# File 'lib/ann_wrapper/ann_manga.rb', line 45

def ratings
	super @ann_manga
end

#staff[ANN_Staff]

Returns array of ANN_Staff

Returns:

  • ([ANN_Staff])

    returns array of ANN_Staff



40
41
42
# File 'lib/ann_wrapper/ann_manga.rb', line 40

def staff
	super @ann_manga
end

#to_hHash

Returns hash of self.

Returns:

  • (Hash)

    hash of self



50
51
52
53
# File 'lib/ann_wrapper/ann_manga.rb', line 50

def to_h
	# create hash excluding some methods
	to_hash([:to_h, :ann_manga=, :find_info])
end

#typeString

Returns manga type

Returns:

  • (String)

    returns manga type



35
36
37
# File 'lib/ann_wrapper/ann_manga.rb', line 35

def type
	@type ||= @ann_manga['type']
end