class ANN_Anime

Attributes

ann_anime[W]

ann_anime Nokogiri object

Public Class Methods

new(ann_anime) click to toggle source

initialize and create info methods

# File lib/ann_wrapper/ann_anime.rb, line 9
def initialize(ann_anime)
        @ann_anime = ann_anime

        # information available from detail
        @info = Hash.new
        @info[:title]         = "Main title"
        @info[:synopsis]      = "Plot Summary"
        @info[:num_episodes]  = "Number of episodes"
        @info[:genres]        = "Genres"
        @info[:themes]        = "Themes"
        @info[:vintage]       = "Vintage"
        @info[:op_theme]      = "Opening Theme"
        @info[:ed_theme]      = "Ending Theme"

        # create methods
        create_methods(@ann_anime, @info)

end

Public Instance Methods

cast() click to toggle source

@return [[ANN_Cast]] returns array of ANN_Cast

# File lib/ann_wrapper/ann_anime.rb, line 57
def cast
        @cast ||= @ann_anime.xpath("./cast").map do |s|
                role = s.at_xpath("role")
                person = s.at_xpath("person")
                ANN_Cast.new(person['id'], role.content, person.content, s['lang'])
        end
end
ed_theme() click to toggle source

@return [[String]] returns ed theme(s)

# File lib/ann_wrapper/ann_anime.rb, line 84
def ed_theme; end
episodes() click to toggle source

@return [[ANN_Episode]] returns array of ANN_Episode

# File lib/ann_wrapper/ann_anime.rb, line 49
def episodes
        @episodes ||= @ann_anime.xpath("./episode").map do |e|
                title = e.at_xpath("title")
                ANN_Episode.new(e['num'], title.content, title['lang'])
        end
end
find_info(key) click to toggle source

@return [Nokogiri::XML::NodeSet] return all info with provided key

Calls superclass method ANN_Media#find_info
# File lib/ann_wrapper/ann_anime.rb, line 29
def find_info(key)
        super(@ann_anime, key)
end
id() click to toggle source

@return [String] returns anime id

# File lib/ann_wrapper/ann_anime.rb, line 34
def id
        @id ||= @ann_anime['id']
end
num_episodes() click to toggle source

@return [[String]] returns number of episodes

# File lib/ann_wrapper/ann_anime.rb, line 80
def num_episodes; end
op_theme() click to toggle source

@return [[String]] returns op theme(s)

# File lib/ann_wrapper/ann_anime.rb, line 82
def op_theme; end
ratings() click to toggle source

@return [[ANN_Rating]] returns array of ANN_Episode

Calls superclass method ANN_Media#ratings
# File lib/ann_wrapper/ann_anime.rb, line 44
def ratings
        super @ann_anime
end
staff() click to toggle source

@return [[ANN_Staff]] returns array of ANN_Staff

Calls superclass method ANN_Media#staff
# File lib/ann_wrapper/ann_anime.rb, line 66
def staff
        super @ann_anime
end
to_h() click to toggle source

@return [Hash] hash of self

# File lib/ann_wrapper/ann_anime.rb, line 71
def to_h
        # create hash excluding some methods
        to_hash([:to_h, :ann_anime=, :find_info])
end
type() click to toggle source

@return [String] returns anime type

# File lib/ann_wrapper/ann_anime.rb, line 39
def type
        @type ||= @ann_anime['type']
end