Class: NicoQuery::ObjectMapper::MylistRSS::Meta
- Inherits:
-
Object
- Object
- NicoQuery::ObjectMapper::MylistRSS::Meta
- Defined in:
- lib/nicoquery/object_mapper/mylist_rss.rb
Instance Method Summary collapse
- #creator ⇒ Object
- #description ⇒ Object
-
#initialize(parsed_xml, title_prefix) ⇒ Meta
constructor
A new instance of Meta.
- #last_build_date ⇒ Object
- #link ⇒ Object
- #mylist_id ⇒ Object
- #publish_date ⇒ Object
- #title ⇒ Object
- #url ⇒ Object
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
#creator ⇒ Object
71 72 73 74 |
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 71 def creator return nil unless @hash['dc:creator'].present? @hash['dc:creator'] end |
#description ⇒ Object
55 56 57 58 59 |
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 55 def description return nil unless @hash['description'].present? return nil if @hash['description'] == "このマイリストは非公開に設定されています。" @hash['description'] end |
#last_build_date ⇒ Object
66 67 68 69 |
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 66 def last_build_date return nil unless @hash['lastBuildDate'].present? Time.parse @hash['lastBuildDate'] end |
#link ⇒ Object
46 47 48 |
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 46 def link @hash['link'].presence end |
#mylist_id ⇒ Object
50 51 52 53 |
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 50 def mylist_id return nil unless @hash['link'].present? @hash['link'].scan(/(?<=mylist\/)\d{1,}/)[0].to_i end |
#publish_date ⇒ Object
61 62 63 64 |
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 61 def publish_date return nil unless @hash['publish_date'].present? Time.parse @hash['publish_date'] end |
#title ⇒ Object
37 38 39 40 |
# 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 |
#url ⇒ Object
42 43 44 |
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 42 def url link end |