Sha256: 551359d0a781493256e156382e26cf25c4532e9d55743e509c6282c2c2c2abbe
Contents?: true
Size: 758 Bytes
Versions: 1
Compression:
Stored size: 758 Bytes
Contents
require File.expand_path('../strategies', __FILE__) module FormattedURL # Finds URL source class URLSourceResolver # The URL path attr_accessor :path # Working format attr_reader :format # Receives the +path+ for URL # and +format+ to work with def initialize(path, format = :default) @path = path @format = format end # Defines URL source def source STRATEGIES.each_key do |key| if clean_url.include? key.to_s return key end end return :default end # Returns the final formatted URL def url STRATEGIES[source].url(path, format) end private # URL without "dot" def clean_url @path.gsub('.','') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
formatted_url-0.0.6 | lib/formatted_url/url_source_resolver.rb |