Class: NicoQuery::ObjectMapper::MylistRSS::Meta

Inherits:
Object
  • Object
show all
Defined in:
lib/nicoquery/object_mapper/mylist_rss.rb

Instance Method Summary collapse

Constructor Details

#initialize(parsed_xml, title_prefix) ⇒ Meta

Returns a new instance of Meta.



28
29
30
31
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 28

def initialize(parsed_xml, title_prefix)
  @title_prefix = title_prefix
  @hash = parsed_xml
end

Instance Method Details

#creatorObject



63
64
65
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 63

def creator
  @hash['dc:creator']
end

#descriptionObject



51
52
53
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 51

def description
  @hash['description']
end

#last_build_dateObject



59
60
61
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 59

def last_build_date
  Time.parse @hash['lastBuildDate']
end


43
44
45
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 43

def link
  @hash['link']
end

#mylist_idObject



47
48
49
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 47

def mylist_id
  @hash['link'].scan(/(?<=mylist\/)\d{1,}/)[0].to_i
end

#publish_dateObject



55
56
57
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 55

def publish_date
  Time.parse @hash['publish_date']
end

#titleObject



33
34
35
36
37
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 33

def title
  @hash['title']
    .scan(/(?<=#{@title_prefix}\s).+(?=\‐ニコニコ動画)/)[0].split(' ')[0]
    # .force_encoding('utf-8')
end

#urlObject



39
40
41
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 39

def url
  link
end