Class: Ytopics::Topic

Inherits:
Object
  • Object
show all
Defined in:
lib/ytopics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Topic

Returns a new instance of Topic.

Yields:

  • (_self)

Yield Parameters:



9
10
11
# File 'lib/ytopics.rb', line 9

def initialize
  yield self
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



7
8
9
# File 'lib/ytopics.rb', line 7

def body
  @body
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/ytopics.rb', line 7

def title
  @title
end

#urlObject

Returns the value of attribute url.



7
8
9
# File 'lib/ytopics.rb', line 7

def url
  @url
end

Instance Method Details

#showObject



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