module FFXIV::Lodestone

Public Class Methods

d(str) click to toggle source
# File lib/ffxiv/lodestone.rb, line 28
def d(str)
  puts "\033[35m[Debug]\033[0m #{str}" if @@debug
end
debug() click to toggle source
# File lib/ffxiv/lodestone.rb, line 20
def debug
  @@debug
end
debug=(flag) click to toggle source
# File lib/ffxiv/lodestone.rb, line 24
def debug=(flag)
  @@debug = flag
end
fetch(endpoint) click to toggle source
# File lib/ffxiv/lodestone.rb, line 32
def fetch(endpoint)
  uri = "http://na.finalfantasyxiv.com/lodestone/" + endpoint
  d("Fetching #{uri} ......")
  html, charset = open(uri) do |page|
    [page.read, page.charset]
  end
  d("    done (size=#{html.size}, charset=#{charset})")
  Nokogiri::HTML.parse(html, nil, charset)
end