Sha256: 4a49c4322b84d7c8a3b5dd11db35d1b11843854164df8b60417fe4f01e4a4c5f
Contents?: true
Size: 867 Bytes
Versions: 1
Compression:
Stored size: 867 Bytes
Contents
module WebService class Site def initialize(url) @url = URI(url) end # Returns a URI. def url(options={}) @url end def credentials [url.user, url.password] if url.user end # Returns a String. def url_for(path, options={}) url_to_path = url(options) url_to_path.path = path return url_to_path.to_s end def root url_for '/' end # This class is supposed to be used within a Rails app. class Switch < Site def initialize(public, local) @public, @local = URI.parse(public), URI.parse(local) end def url(options={}) url = (Rails.env.production? || options[:public] ? @public : @local).dup url.port = @local.port if options[:public] && !Rails.env.production? return url end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Roman2K-web-service-0.1.1 | lib/web_service/site.rb |