7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/fxkeb.rb', line 7
def self.to_usd(krw)
begin
s = Net::HTTP.get('community.fxkeb.com', '/fxportal/jsp/RS/DEPLOY_EXRATE/2533_0.html')
s = s.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "")
doc = Nokogiri::HTML(s) s = doc.css("td.text01")[5].content.to_s
s = s[1..-1]
unless s.length==7
puts "!!!!!!! ERROR !!!!!!! s=>[#{s}]"
end
puts "fx => [#{s}]"
puts "fx => [#{s.to_f}]"
return (krw*10/s.to_f).ceil.to_f/10
rescue
return krw/FIXED_RATE
end
end
|