Sha256: d5b43bfd571c01700ba7dc374e7b7599b5bd0ae36dd64026369d46082959f2bb

Contents?: true

Size: 518 Bytes

Versions: 12

Compression:

Stored size: 518 Bytes

Contents

# frozen_string_literal: true

module PageMagic
  module Utils
    # module String - contains methods for manipulating strings
    module URL
      class << self
        # build a url from a base and path.
        # @example
        #  concat('http://base.url/', '/path') # => "http://base.url/path"
        # @return [String]
        def concat(base_url, path)
          path = path.sub(%r{^/}, '')
          base_url = base_url.sub(%r{/$}, '')
          "#{base_url}/#{path}"
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
page_magic-2.0.13 lib/page_magic/utils/url.rb
page_magic-2.0.12 lib/page_magic/utils/url.rb
page_magic-2.0.11 lib/page_magic/utils/url.rb
page_magic-2.0.10 lib/page_magic/utils/url.rb
page_magic-2.0.9 lib/page_magic/utils/url.rb
page_magic-2.0.6 lib/page_magic/utils/url.rb
page_magic-2.0.5 lib/page_magic/utils/url.rb
page_magic-2.0.4 lib/page_magic/utils/url.rb
page_magic-2.0.3 lib/page_magic/utils/url.rb
page_magic-2.0.2 lib/page_magic/utils/url.rb
page_magic-2.0.1 lib/page_magic/utils/url.rb
page_magic-2.0.0 lib/page_magic/utils/url.rb