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.



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

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

Instance Method Details

#creatorObject



67
68
69
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 67

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

#descriptionObject



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

def description
  @hash['description']
end

#last_build_dateObject



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

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


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

def link
  @hash['link']
end

#mylist_idObject



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

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

#publish_dateObject



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

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

#titleObject



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

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

#urlObject



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

def url
  link
end