Sha256: 9049922e704d0535359699ce9d05d3f69f4a62f29a5233c796f6198d2dd6fb76
Contents?: true
Size: 765 Bytes
Versions: 4
Compression:
Stored size: 765 Bytes
Contents
require 'cgi' require "active_support/core_ext/object/to_query" require "active_support/core_ext/object/blank" module Kuebiko class Preparation attr_reader :scheme, :host, :port def initialize(paths, options) @paths = paths @query = options[:query] @anchor = options[:anchor] @trailing_slash = options[:trailing_slash] @scheme = options[:scheme] @host = options[:host] @port = options[:port] end def build path = @paths.select{|item| item.present?}.map{|item| CGI.escape(item.to_s)}.join('/') path << "/" if path.present? && @trailing_slash path << "?#{@query.to_query}" if @query.present? path << "##{CGI.escape(@anchor.to_s)}" if @anchor.present? path end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
kuebiko-0.2.0 | lib/kuebiko/preparation.rb |
kuebiko-0.1.2 | lib/kuebiko/preparation.rb |
kuebiko-0.1.1 | lib/kuebiko/preparation.rb |
kuebiko-0.1.0 | lib/kuebiko/preparation.rb |