class Npbs::NPB
Your code goes here…
Attributes
base_url[R]
path[R]
Public Class Methods
new()
click to toggle source
# File lib/npbs.rb, line 13 def initialize @base_url = "http://bis.npb.or.jp"; @path = ""; # http://bis.npb.or.jpだけを対象にするので、文字コードは決め打ち @charset = "Shift-jis" end
Public Instance Methods
fetch_doc(ext_path=nil)
click to toggle source
# File lib/npbs.rb, line 20 def fetch_doc(ext_path=nil) Nokogiri::HTML(fetch_html(ext_path), nil, @charset) end
fetch_html(ext_path=nil)
click to toggle source
# File lib/npbs.rb, line 24 def fetch_html(ext_path=nil) path = ext_path.nil? ? @path : ext_path URI.parse(@base_url + path).read end