class Proximity::ProxySet
Attributes
route_set[RW]
source[RW]
target[RW]
Public Class Methods
default_scheme()
click to toggle source
# File lib/proximity/proxy_set.rb, line 6 def self.default_scheme 'http' end
new(route_set, source, target)
click to toggle source
# File lib/proximity/proxy_set.rb, line 10 def initialize(route_set, source, target) self.route_set = route_set self.source = source self.target = target end
Public Instance Methods
routes()
click to toggle source
# File lib/proximity/proxy_set.rb, line 16 def routes route_set.routes end
Private Instance Methods
env_tld(url)
click to toggle source
# File lib/proximity/proxy_set.rb, line 55 def env_tld(url) %w[development test].include?(Proximity.env) ? url.sub('.com', '.dev') : url end
normalize_source(source)
click to toggle source
# File lib/proximity/proxy_set.rb, line 45 def normalize_source(source) source.starts_with?('/') ? source : "/#{source}" end
normalize_target(target)
click to toggle source
# File lib/proximity/proxy_set.rb, line 49 def normalize_target(target) uri = URI.parse(target) target = uri.scheme.nil? ? "#{self.class.default_scheme}://#{target}" : target env_tld target end
source=(value)
click to toggle source
# File lib/proximity/proxy_set.rb, line 37 def source=(value) @source = normalize_source(value) end
target=(value)
click to toggle source
# File lib/proximity/proxy_set.rb, line 41 def target=(value) @target = normalize_target(value) end