Class: Ytopics::Topic
- Inherits:
-
Object
- Object
- Ytopics::Topic
- Defined in:
- lib/ytopics.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Topic
constructor
A new instance of Topic.
- #show ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Topic
Returns a new instance of Topic.
9 10 11 |
# File 'lib/ytopics.rb', line 9 def initialize yield self end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/ytopics.rb', line 7 def body @body end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/ytopics.rb', line 7 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/ytopics.rb', line 7 def url @url end |
Instance Method Details
#show ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ytopics.rb', line 13 def show if self.body.nil? flg = false open(self.url, "r:euc-jp") do |f| f.read.encode("utf-8").scan(/<!--HBODY-->(.+?)</) {|m|self.body = m.first} end end puts "<#{self.title}>" puts self.body end |