Skip to content

Commit

Permalink
Move from tab to space indentation
Browse files Browse the repository at this point in the history
This was done to conform with the rest of the Ruby community.
  • Loading branch information
lawrencewoodman committed Apr 2, 2011
1 parent 059554f commit ca97895
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions domain_name.filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

module DomainNameFilter

# Return the url's domain name
def domain_name(url)
return url.sub(%r{(http://){0,1}([^/]*)(/.*$){0,1}}i, '\\2')
end
# Return the url's domain name
def domain_name(url)
return url.sub(%r{(http://){0,1}([^/]*)(/.*$){0,1}}i, '\\2')
end

end

Expand Down
26 changes: 13 additions & 13 deletions test/test_domain_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ def setup
@context = Context.new
end

def test_domain_name
urls = ['http://example.com',
'HTTP://example.com',
'http://example.com/reviews/',
'http://example.com/reviews/index.php',
'example.com',
'example.com/reviews/',
'example.com/reviews/index.php']
def test_domain_name
urls = ['http://example.com',
'HTTP://example.com',
'http://example.com/reviews/',
'http://example.com/reviews/index.php',
'example.com',
'example.com/reviews/',
'example.com/reviews/index.php']

urls.each do |url|
@context['var'] = url
assert_equal "example.com", Variable.new("var | domain_name").render(@context)
end
end
urls.each do |url|
@context['var'] = url
assert_equal "example.com", Variable.new("var | domain_name").render(@context)
end
end

end

0 comments on commit ca97895

Please sign in to comment.