Class: BBS2ch::Post
- Inherits:
-
Object
- Object
- BBS2ch::Post
- Defined in:
- lib/bbs2ch/post.rb
Instance Attribute Summary collapse
-
#be ⇒ Object
Returns the value of attribute be.
-
#body ⇒ Object
Returns the value of attribute body.
-
#email ⇒ Object
Returns the value of attribute email.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#time ⇒ Object
Returns the value of attribute time.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #fc2 ⇒ Object
- #fix_ttp(urls) ⇒ Object
- #images ⇒ Object
-
#initialize(name, email, time, id, be, body, title) ⇒ Post
constructor
A new instance of Post.
- #videos ⇒ Object
- #xvideos ⇒ Object
Constructor Details
#initialize(name, email, time, id, be, body, title) ⇒ Post
Returns a new instance of Post.
3 4 5 6 7 8 9 10 11 |
# File 'lib/bbs2ch/post.rb', line 3 def initialize(name, email, time, id, be, body, title) @name = name @email = email @time = time @id = id @be = be @body = body @title = title end |
Instance Attribute Details
#be ⇒ Object
Returns the value of attribute be.
33 34 35 |
# File 'lib/bbs2ch/post.rb', line 33 def be @be end |
#body ⇒ Object
Returns the value of attribute body.
33 34 35 |
# File 'lib/bbs2ch/post.rb', line 33 def body @body end |
#email ⇒ Object
Returns the value of attribute email.
33 34 35 |
# File 'lib/bbs2ch/post.rb', line 33 def email @email end |
#id ⇒ Object
Returns the value of attribute id.
33 34 35 |
# File 'lib/bbs2ch/post.rb', line 33 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
33 34 35 |
# File 'lib/bbs2ch/post.rb', line 33 def name @name end |
#time ⇒ Object
Returns the value of attribute time.
33 34 35 |
# File 'lib/bbs2ch/post.rb', line 33 def time @time end |
#title ⇒ Object
Returns the value of attribute title.
33 34 35 |
# File 'lib/bbs2ch/post.rb', line 33 def title @title end |
Instance Method Details
#fc2 ⇒ Object
25 26 27 |
# File 'lib/bbs2ch/post.rb', line 25 def fc2 fix_ttp @body.scan(%r{ttp://video\.fc2\.com/a/content/[0-9a-zA-Z]+}) end |
#fix_ttp(urls) ⇒ Object
29 30 31 |
# File 'lib/bbs2ch/post.rb', line 29 def fix_ttp(urls) urls.map { |url| url.gsub(/^ttp/, 'http') } end |
#images ⇒ Object
13 14 15 |
# File 'lib/bbs2ch/post.rb', line 13 def images fix_ttp @body.scan(%r{ttps?:.*\.(?:jpg|png|gif)}) end |
#videos ⇒ Object
17 18 19 |
# File 'lib/bbs2ch/post.rb', line 17 def videos xvideos + fc2 end |
#xvideos ⇒ Object
21 22 23 |
# File 'lib/bbs2ch/post.rb', line 21 def xvideos fix_ttp @body.scan(%r{ttp://(?:www|jp)\.xvideos\.com/video[0-9]+}) end |