doc/Ballast/RequestDomainMatcher.html in ballast-2.0.1 vs doc/Ballast/RequestDomainMatcher.html in ballast-2.1.0

- old
+ new

@@ -388,16 +388,17 @@ 31</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/ballast/request_domain_matcher.rb', line 26</span> -<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_domains'>domains</span><span class='comma'>,</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.dev$</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='id identifier rubyid_replace_string'>replace_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_replace_block'>replace_block</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span> <span class='op'>=</span> <span class='id identifier rubyid_domains'>domains</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span> - <span class='ivar'>@replace_pattern</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> - <span class='ivar'>@replace_string</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_string'>replace_string</span> - <span class='ivar'>@replace_block</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_block'>replace_block</span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_domains identifier id'>domains</span><span class='comma token'>,</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> <span class='assign token'>=</span> <span class='regexp val'>/\.dev$/</span><span class='comma token'>,</span> <span class='rubyid_replace_string identifier id'>replace_string</span> <span class='assign token'>=</span> <span class='string val'>&quot;&quot;</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_replace_block identifier id'>replace_block</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span> <span class='assign token'>=</span> <span class='rubyid_domains identifier id'>domains</span><span class='dot token'>.</span><span class='rubyid_ensure_array identifier id'>ensure_array</span> + <span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span> <span class='assign token'>=</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> + <span class='rubyid_@replace_string ivar id'>@replace_string</span> <span class='assign token'>=</span> <span class='rubyid_replace_string identifier id'>replace_string</span> + <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='assign token'>=</span> <span class='rubyid_replace_block identifier id'>replace_block</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -477,35 +478,36 @@ 41</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/ballast/request_domain_matcher.rb', line 17</span> -<span class='kw'>class</span> <span class='const'>RequestDomainMatcher</span> - <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:domains</span><span class='comma'>,</span> <span class='symbol'>:replace_pattern</span><span class='comma'>,</span> <span class='symbol'>:replace_string</span><span class='comma'>,</span> <span class='symbol'>:replace_block</span> +<span class='rubyid_class class kw'>class</span> <span class='rubyid_RequestDomainMatcher constant id'>RequestDomainMatcher</span> + <span class='rubyid_attr_accessor identifier id'>attr_accessor</span> <span class='symbol val'>:domains</span><span class='comma token'>,</span> <span class='symbol val'>:replace_pattern</span><span class='comma token'>,</span> <span class='symbol val'>:replace_string</span><span class='comma token'>,</span> <span class='symbol val'>:replace_block</span> - <span class='comment'># Creates a new matcher. -</span> <span class='comment'># -</span> <span class='comment'># @param domains [String|Array] The list of domains which mark a positive match. -</span> <span class='comment'># @param replace_pattern [String|Regexp] A optional pattern to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='comment'># @param replace_string [String] A string to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='comment'># @param replace_block [Proc] A block to use to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_domains'>domains</span><span class='comma'>,</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.dev$</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='id identifier rubyid_replace_string'>replace_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_replace_block'>replace_block</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span> <span class='op'>=</span> <span class='id identifier rubyid_domains'>domains</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span> - <span class='ivar'>@replace_pattern</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> - <span class='ivar'>@replace_string</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_string'>replace_string</span> - <span class='ivar'>@replace_block</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_block'>replace_block</span> - <span class='kw'>end</span> + <span class='comment val'># Creates a new matcher.</span> + <span class='comment val'>#</span> + <span class='comment val'># @param domains [String|Array] The list of domains which mark a positive match.</span> + <span class='comment val'># @param replace_pattern [String|Regexp] A optional pattern to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='comment val'># @param replace_string [String] A string to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='comment val'># @param replace_block [Proc] A block to use to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_domains identifier id'>domains</span><span class='comma token'>,</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> <span class='assign token'>=</span> <span class='regexp val'>/\.dev$/</span><span class='comma token'>,</span> <span class='rubyid_replace_string identifier id'>replace_string</span> <span class='assign token'>=</span> <span class='string val'>&quot;&quot;</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_replace_block identifier id'>replace_block</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span> <span class='assign token'>=</span> <span class='rubyid_domains identifier id'>domains</span><span class='dot token'>.</span><span class='rubyid_ensure_array identifier id'>ensure_array</span> + <span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span> <span class='assign token'>=</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> + <span class='rubyid_@replace_string ivar id'>@replace_string</span> <span class='assign token'>=</span> <span class='rubyid_replace_string identifier id'>replace_string</span> + <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='assign token'>=</span> <span class='rubyid_replace_block identifier id'>replace_block</span> + <span class='rubyid_end end kw'>end</span> - <span class='comment'># Matches a request. -</span> <span class='comment'># -</span> <span class='comment'># @param request [ActionDispatch::Request] The request to match. -</span> <span class='comment'># @return [Boolean] `true` if the request matches, `false` otherwise. -</span> <span class='kw'>def</span> <span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span> - <span class='id identifier rubyid_final_host'>final_host</span> <span class='op'>=</span> <span class='ivar'>@replace_block</span> <span class='op'>?</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='ivar'>@replace_block</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='ivar'>@replace_string</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_final_host'>final_host</span><span class='rparen'>)</span> - <span class='kw'>end</span> -<span class='kw'>end</span></pre> + <span class='comment val'># Matches a request.</span> + <span class='comment val'>#</span> + <span class='comment val'># @param request [ActionDispatch::Request] The request to match.</span> + <span class='comment val'># @return [Boolean] `true` if the request matches, `false` otherwise.</span> + <span class='rubyid_def def kw'>def</span> <span class='rubyid_matches? fid id'>matches?</span><span class='lparen token'>(</span><span class='rubyid_request identifier id'>request</span><span class='rparen token'>)</span> + <span class='rubyid_final_host identifier id'>final_host</span> <span class='assign token'>=</span> <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='question op'>?</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_@replace_block ivar id'>@replace_block</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='rubyid_@replace_string ivar id'>@replace_string</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_final_host identifier id'>final_host</span><span class='rparen token'>)</span> + <span class='rubyid_end end kw'>end</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -580,35 +582,36 @@ 41</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/ballast/request_domain_matcher.rb', line 17</span> -<span class='kw'>class</span> <span class='const'>RequestDomainMatcher</span> - <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:domains</span><span class='comma'>,</span> <span class='symbol'>:replace_pattern</span><span class='comma'>,</span> <span class='symbol'>:replace_string</span><span class='comma'>,</span> <span class='symbol'>:replace_block</span> +<span class='rubyid_class class kw'>class</span> <span class='rubyid_RequestDomainMatcher constant id'>RequestDomainMatcher</span> + <span class='rubyid_attr_accessor identifier id'>attr_accessor</span> <span class='symbol val'>:domains</span><span class='comma token'>,</span> <span class='symbol val'>:replace_pattern</span><span class='comma token'>,</span> <span class='symbol val'>:replace_string</span><span class='comma token'>,</span> <span class='symbol val'>:replace_block</span> - <span class='comment'># Creates a new matcher. -</span> <span class='comment'># -</span> <span class='comment'># @param domains [String|Array] The list of domains which mark a positive match. -</span> <span class='comment'># @param replace_pattern [String|Regexp] A optional pattern to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='comment'># @param replace_string [String] A string to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='comment'># @param replace_block [Proc] A block to use to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_domains'>domains</span><span class='comma'>,</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.dev$</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='id identifier rubyid_replace_string'>replace_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_replace_block'>replace_block</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span> <span class='op'>=</span> <span class='id identifier rubyid_domains'>domains</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span> - <span class='ivar'>@replace_pattern</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> - <span class='ivar'>@replace_string</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_string'>replace_string</span> - <span class='ivar'>@replace_block</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_block'>replace_block</span> - <span class='kw'>end</span> + <span class='comment val'># Creates a new matcher.</span> + <span class='comment val'>#</span> + <span class='comment val'># @param domains [String|Array] The list of domains which mark a positive match.</span> + <span class='comment val'># @param replace_pattern [String|Regexp] A optional pattern to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='comment val'># @param replace_string [String] A string to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='comment val'># @param replace_block [Proc] A block to use to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_domains identifier id'>domains</span><span class='comma token'>,</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> <span class='assign token'>=</span> <span class='regexp val'>/\.dev$/</span><span class='comma token'>,</span> <span class='rubyid_replace_string identifier id'>replace_string</span> <span class='assign token'>=</span> <span class='string val'>&quot;&quot;</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_replace_block identifier id'>replace_block</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span> <span class='assign token'>=</span> <span class='rubyid_domains identifier id'>domains</span><span class='dot token'>.</span><span class='rubyid_ensure_array identifier id'>ensure_array</span> + <span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span> <span class='assign token'>=</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> + <span class='rubyid_@replace_string ivar id'>@replace_string</span> <span class='assign token'>=</span> <span class='rubyid_replace_string identifier id'>replace_string</span> + <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='assign token'>=</span> <span class='rubyid_replace_block identifier id'>replace_block</span> + <span class='rubyid_end end kw'>end</span> - <span class='comment'># Matches a request. -</span> <span class='comment'># -</span> <span class='comment'># @param request [ActionDispatch::Request] The request to match. -</span> <span class='comment'># @return [Boolean] `true` if the request matches, `false` otherwise. -</span> <span class='kw'>def</span> <span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span> - <span class='id identifier rubyid_final_host'>final_host</span> <span class='op'>=</span> <span class='ivar'>@replace_block</span> <span class='op'>?</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='ivar'>@replace_block</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='ivar'>@replace_string</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_final_host'>final_host</span><span class='rparen'>)</span> - <span class='kw'>end</span> -<span class='kw'>end</span></pre> + <span class='comment val'># Matches a request.</span> + <span class='comment val'>#</span> + <span class='comment val'># @param request [ActionDispatch::Request] The request to match.</span> + <span class='comment val'># @return [Boolean] `true` if the request matches, `false` otherwise.</span> + <span class='rubyid_def def kw'>def</span> <span class='rubyid_matches? fid id'>matches?</span><span class='lparen token'>(</span><span class='rubyid_request identifier id'>request</span><span class='rparen token'>)</span> + <span class='rubyid_final_host identifier id'>final_host</span> <span class='assign token'>=</span> <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='question op'>?</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_@replace_block ivar id'>@replace_block</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='rubyid_@replace_string ivar id'>@replace_string</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_final_host identifier id'>final_host</span><span class='rparen token'>)</span> + <span class='rubyid_end end kw'>end</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -683,35 +686,36 @@ 41</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/ballast/request_domain_matcher.rb', line 17</span> -<span class='kw'>class</span> <span class='const'>RequestDomainMatcher</span> - <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:domains</span><span class='comma'>,</span> <span class='symbol'>:replace_pattern</span><span class='comma'>,</span> <span class='symbol'>:replace_string</span><span class='comma'>,</span> <span class='symbol'>:replace_block</span> +<span class='rubyid_class class kw'>class</span> <span class='rubyid_RequestDomainMatcher constant id'>RequestDomainMatcher</span> + <span class='rubyid_attr_accessor identifier id'>attr_accessor</span> <span class='symbol val'>:domains</span><span class='comma token'>,</span> <span class='symbol val'>:replace_pattern</span><span class='comma token'>,</span> <span class='symbol val'>:replace_string</span><span class='comma token'>,</span> <span class='symbol val'>:replace_block</span> - <span class='comment'># Creates a new matcher. -</span> <span class='comment'># -</span> <span class='comment'># @param domains [String|Array] The list of domains which mark a positive match. -</span> <span class='comment'># @param replace_pattern [String|Regexp] A optional pattern to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='comment'># @param replace_string [String] A string to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='comment'># @param replace_block [Proc] A block to use to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_domains'>domains</span><span class='comma'>,</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.dev$</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='id identifier rubyid_replace_string'>replace_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_replace_block'>replace_block</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span> <span class='op'>=</span> <span class='id identifier rubyid_domains'>domains</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span> - <span class='ivar'>@replace_pattern</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> - <span class='ivar'>@replace_string</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_string'>replace_string</span> - <span class='ivar'>@replace_block</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_block'>replace_block</span> - <span class='kw'>end</span> + <span class='comment val'># Creates a new matcher.</span> + <span class='comment val'>#</span> + <span class='comment val'># @param domains [String|Array] The list of domains which mark a positive match.</span> + <span class='comment val'># @param replace_pattern [String|Regexp] A optional pattern to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='comment val'># @param replace_string [String] A string to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='comment val'># @param replace_block [Proc] A block to use to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_domains identifier id'>domains</span><span class='comma token'>,</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> <span class='assign token'>=</span> <span class='regexp val'>/\.dev$/</span><span class='comma token'>,</span> <span class='rubyid_replace_string identifier id'>replace_string</span> <span class='assign token'>=</span> <span class='string val'>&quot;&quot;</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_replace_block identifier id'>replace_block</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span> <span class='assign token'>=</span> <span class='rubyid_domains identifier id'>domains</span><span class='dot token'>.</span><span class='rubyid_ensure_array identifier id'>ensure_array</span> + <span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span> <span class='assign token'>=</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> + <span class='rubyid_@replace_string ivar id'>@replace_string</span> <span class='assign token'>=</span> <span class='rubyid_replace_string identifier id'>replace_string</span> + <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='assign token'>=</span> <span class='rubyid_replace_block identifier id'>replace_block</span> + <span class='rubyid_end end kw'>end</span> - <span class='comment'># Matches a request. -</span> <span class='comment'># -</span> <span class='comment'># @param request [ActionDispatch::Request] The request to match. -</span> <span class='comment'># @return [Boolean] `true` if the request matches, `false` otherwise. -</span> <span class='kw'>def</span> <span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span> - <span class='id identifier rubyid_final_host'>final_host</span> <span class='op'>=</span> <span class='ivar'>@replace_block</span> <span class='op'>?</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='ivar'>@replace_block</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='ivar'>@replace_string</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_final_host'>final_host</span><span class='rparen'>)</span> - <span class='kw'>end</span> -<span class='kw'>end</span></pre> + <span class='comment val'># Matches a request.</span> + <span class='comment val'>#</span> + <span class='comment val'># @param request [ActionDispatch::Request] The request to match.</span> + <span class='comment val'># @return [Boolean] `true` if the request matches, `false` otherwise.</span> + <span class='rubyid_def def kw'>def</span> <span class='rubyid_matches? fid id'>matches?</span><span class='lparen token'>(</span><span class='rubyid_request identifier id'>request</span><span class='rparen token'>)</span> + <span class='rubyid_final_host identifier id'>final_host</span> <span class='assign token'>=</span> <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='question op'>?</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_@replace_block ivar id'>@replace_block</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='rubyid_@replace_string ivar id'>@replace_string</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_final_host identifier id'>final_host</span><span class='rparen token'>)</span> + <span class='rubyid_end end kw'>end</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -786,35 +790,36 @@ 41</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/ballast/request_domain_matcher.rb', line 17</span> -<span class='kw'>class</span> <span class='const'>RequestDomainMatcher</span> - <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:domains</span><span class='comma'>,</span> <span class='symbol'>:replace_pattern</span><span class='comma'>,</span> <span class='symbol'>:replace_string</span><span class='comma'>,</span> <span class='symbol'>:replace_block</span> +<span class='rubyid_class class kw'>class</span> <span class='rubyid_RequestDomainMatcher constant id'>RequestDomainMatcher</span> + <span class='rubyid_attr_accessor identifier id'>attr_accessor</span> <span class='symbol val'>:domains</span><span class='comma token'>,</span> <span class='symbol val'>:replace_pattern</span><span class='comma token'>,</span> <span class='symbol val'>:replace_string</span><span class='comma token'>,</span> <span class='symbol val'>:replace_block</span> - <span class='comment'># Creates a new matcher. -</span> <span class='comment'># -</span> <span class='comment'># @param domains [String|Array] The list of domains which mark a positive match. -</span> <span class='comment'># @param replace_pattern [String|Regexp] A optional pattern to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='comment'># @param replace_string [String] A string to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='comment'># @param replace_block [Proc] A block to use to manipulate the request host before trying the match. See `String#gsub`. -</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_domains'>domains</span><span class='comma'>,</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.dev$</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='id identifier rubyid_replace_string'>replace_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_replace_block'>replace_block</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span> <span class='op'>=</span> <span class='id identifier rubyid_domains'>domains</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span> - <span class='ivar'>@replace_pattern</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_pattern'>replace_pattern</span> - <span class='ivar'>@replace_string</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_string'>replace_string</span> - <span class='ivar'>@replace_block</span> <span class='op'>=</span> <span class='id identifier rubyid_replace_block'>replace_block</span> - <span class='kw'>end</span> + <span class='comment val'># Creates a new matcher.</span> + <span class='comment val'>#</span> + <span class='comment val'># @param domains [String|Array] The list of domains which mark a positive match.</span> + <span class='comment val'># @param replace_pattern [String|Regexp] A optional pattern to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='comment val'># @param replace_string [String] A string to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='comment val'># @param replace_block [Proc] A block to use to manipulate the request host before trying the match. See `String#gsub`.</span> + <span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_domains identifier id'>domains</span><span class='comma token'>,</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> <span class='assign token'>=</span> <span class='regexp val'>/\.dev$/</span><span class='comma token'>,</span> <span class='rubyid_replace_string identifier id'>replace_string</span> <span class='assign token'>=</span> <span class='string val'>&quot;&quot;</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_replace_block identifier id'>replace_block</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span> <span class='assign token'>=</span> <span class='rubyid_domains identifier id'>domains</span><span class='dot token'>.</span><span class='rubyid_ensure_array identifier id'>ensure_array</span> + <span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span> <span class='assign token'>=</span> <span class='rubyid_replace_pattern identifier id'>replace_pattern</span> + <span class='rubyid_@replace_string ivar id'>@replace_string</span> <span class='assign token'>=</span> <span class='rubyid_replace_string identifier id'>replace_string</span> + <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='assign token'>=</span> <span class='rubyid_replace_block identifier id'>replace_block</span> + <span class='rubyid_end end kw'>end</span> - <span class='comment'># Matches a request. -</span> <span class='comment'># -</span> <span class='comment'># @param request [ActionDispatch::Request] The request to match. -</span> <span class='comment'># @return [Boolean] `true` if the request matches, `false` otherwise. -</span> <span class='kw'>def</span> <span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span> - <span class='id identifier rubyid_final_host'>final_host</span> <span class='op'>=</span> <span class='ivar'>@replace_block</span> <span class='op'>?</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='ivar'>@replace_block</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='ivar'>@replace_string</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_final_host'>final_host</span><span class='rparen'>)</span> - <span class='kw'>end</span> -<span class='kw'>end</span></pre> + <span class='comment val'># Matches a request.</span> + <span class='comment val'>#</span> + <span class='comment val'># @param request [ActionDispatch::Request] The request to match.</span> + <span class='comment val'># @return [Boolean] `true` if the request matches, `false` otherwise.</span> + <span class='rubyid_def def kw'>def</span> <span class='rubyid_matches? fid id'>matches?</span><span class='lparen token'>(</span><span class='rubyid_request identifier id'>request</span><span class='rparen token'>)</span> + <span class='rubyid_final_host identifier id'>final_host</span> <span class='assign token'>=</span> <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='question op'>?</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_@replace_block ivar id'>@replace_block</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='rubyid_@replace_string ivar id'>@replace_string</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_final_host identifier id'>final_host</span><span class='rparen token'>)</span> + <span class='rubyid_end end kw'>end</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> @@ -892,26 +897,27 @@ 40</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/ballast/request_domain_matcher.rb', line 37</span> -<span class='kw'>def</span> <span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span> - <span class='id identifier rubyid_final_host'>final_host</span> <span class='op'>=</span> <span class='ivar'>@replace_block</span> <span class='op'>?</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='ivar'>@replace_block</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='ivar'>@replace_pattern</span><span class='comma'>,</span> <span class='ivar'>@replace_string</span><span class='rparen'>)</span> - <span class='ivar'>@domains</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_final_host'>final_host</span><span class='rparen'>)</span> -<span class='kw'>end</span></pre> +<span class='rubyid_def def kw'>def</span> <span class='rubyid_matches? fid id'>matches?</span><span class='lparen token'>(</span><span class='rubyid_request identifier id'>request</span><span class='rparen token'>)</span> + <span class='rubyid_final_host identifier id'>final_host</span> <span class='assign token'>=</span> <span class='rubyid_@replace_block ivar id'>@replace_block</span> <span class='question op'>?</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_@replace_block ivar id'>@replace_block</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='rubyid_@replace_pattern ivar id'>@replace_pattern</span><span class='comma token'>,</span> <span class='rubyid_@replace_string ivar id'>@replace_string</span><span class='rparen token'>)</span> + <span class='rubyid_@domains ivar id'>@domains</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_final_host identifier id'>final_host</span><span class='rparen token'>)</span> +<span class='rubyid_end end kw'>end</span> +</pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> - Generated on Fri Dec 26 11:54:47 2014 by + Generated on Sun Jan 18 13:27:09 2015 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.8.7.6 (ruby-2.1.3). + 0.8.7.6 (ruby-2.2.0). </div> </body> </html> \ No newline at end of file