Class: NicoQuery::ObjectMapper::MylistRSS::Item::Description

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_text) ⇒ Description



127
128
129
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 127

def initialize(raw_text)
  @raw_text = raw_text.to_s
end

Instance Attribute Details

#raw_textObject (readonly)

Returns the value of attribute raw_text.



125
126
127
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 125

def raw_text
  @raw_text
end

Instance Method Details

#community_referencesObject



145
146
147
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 145

def community_references
  text.scan /co\d{1,}/
end

#movie_referencesObject



136
137
138
139
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 136

def movie_references
  # is this the high road?
  text.scan(/((sm|nm)\d{1,})/).map {|e| e[0]}
end

#mylist_referencesObject



141
142
143
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 141

def mylist_references
  text.scan(/(?<=mylist\/)\d{1,}/).map(&:to_i)
end

#seiga_referencesObject



149
150
151
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 149

def seiga_references
  text.scan /im\d{1,}/
end

#textObject



131
132
133
134
# File 'lib/nicoquery/object_mapper/mylist_rss.rb', line 131

def text
  @raw_text.scan /(?<=class\=\"nico\-description\"\>).{1,}(?=\<\/p\>)/
  $&
end