Class: SourceURLRewriter::Rewriter

Inherits:
Object
  • Object
show all
Defined in:
lib/pod/src/rewriter.rb

Overview

Used to provide rewritten urls People using this pod would install as follows plugin ‘cocoapods-github_token_http_rewriter’,

"pattern" => "replacement"

Instance Method Summary collapse

Instance Method Details

#url_for(url) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pod/src/rewriter.rb', line 8

def url_for(url)
  if user_options
    transformed_key = transform_key(url)

    if transformed_key
      rewritten_url = url.sub(transformed_key, user_options[transformed_key])
      Pod::UI.info("Transforming URL #{url} into #{rewritten_url}")
      return rewritten_url
    end
  else
    Pod::UI.notice('No options have been specified for rewriting.')
  end

  url
end