Sha256: cfa22e21b6c2fa9faab8d00974106a3d214365a8c22e9e14679dc06991627a81
Contents?: true
Size: 840 Bytes
Versions: 5
Compression:
Stored size: 840 Bytes
Contents
module Apiture class URI components = [:scheme, :host, :base_host, :subdomain, :base_path, :resource_path] components.each { |comp| attr_reader comp } components.each do |comp| define_method "#{comp}=".to_sym do |v| instance_variable_set("@#{comp}", v) build_url end end def merge_components(components) components.each_pair do |name, val| instance_variable_set("@#{name}", val) end end def to_s build_url end protected def build_url host = if base_host && subdomain [subdomain, base_host].join('.') else self.host end [ scheme, '://', host, base_path, resource_path ].join('') end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
apiture-0.2.6 | lib/apiture/uri.rb |
apiture-0.2.5 | lib/apiture/uri.rb |
apiture-0.2.4 | lib/apiture/uri.rb |
apiture-0.2.3 | lib/apiture/uri.rb |
apiture-0.2.2 | lib/apiture/uri.rb |