require 'uri' module Host #HOST_RE = // # Returns 'true' value if the handler is capable of processing the url def handle_url?(u) u.host =~ @@HOST_RE end end class Example @@HOST_RE = /example.com$/ class << self include Host end def self.url2img(u) if u.is_a?(string) u = URI.parse(u) end u.path = '/img' + uri.path + '.jpg' end end Example.handle_url?(URI.parse('http://www.example.com/6ABA3/')) #in `handle_url?': uninitialized class variable @@HOST_RE in Host (NameError) # from trash2.rb:27