Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 8257284

Browse files
author
Tobias Haagen Michaelsen
committed
The Ruby methods are called start_with? and end_with? (without s)
1 parent a339265 commit 8257284

File tree

11 files changed

+19
-19
lines changed

11 files changed

+19
-19
lines changed

lib/openid/association.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def sign_message(message)
165165

166166
signed_list = []
167167
message_keys.each { |k|
168-
if k.starts_with?('openid.')
168+
if k.start_with?('openid.')
169169
signed_list << k[7..-1]
170170
end
171171
}

lib/openid/message.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def to_args
254254
post_args = self.to_post_args
255255
kvargs = {}
256256
post_args.each { |k,v|
257-
if !k.starts_with?('openid.')
257+
if !k.start_with?('openid.')
258258
raise ArgumentError, "This message can only be encoded as a POST, because it contains arguments that are not prefixed with 'openid.'"
259259
else
260260
kvargs[k[7..-1]] = v

lib/openid/trustroot.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def validate_url(url)
315315
return false
316316
end
317317
elsif ((@host != '') and
318-
(!host.ends_with?('.' + @host)) and
318+
(!host.end_with?('.' + @host)) and
319319
(host != @host))
320320
return false
321321
end

lib/openid/urinorm.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ def URINorm.remove_dot_segments(path)
4040
result_segments = []
4141

4242
while path.length > 0
43-
if path.starts_with?('../')
43+
if path.start_with?('../')
4444
path = path[3..-1]
45-
elsif path.starts_with?('./')
45+
elsif path.start_with?('./')
4646
path = path[2..-1]
47-
elsif path.starts_with?('/./')
47+
elsif path.start_with?('/./')
4848
path = path[2..-1]
4949
elsif path == '/.'
5050
path = '/'
51-
elsif path.starts_with?('/../')
51+
elsif path.start_with?('/../')
5252
path = path[3..-1]
5353
result_segments.pop if result_segments.length > 0
5454
elsif path == '/..'

test/discoverdata.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def generateResult(base_url, input_name, id_name, result_name, success)
105105

106106
ctype = nil
107107
header_lines.each { |header_line|
108-
if header_line.starts_with?('Content-Type:')
108+
if header_line.start_with?('Content-Type:')
109109
_, ctype = header_line.split(':', 2)
110110
ctype = ctype.strip()
111111
break

test/test_accept.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def chunk(lines)
2929
chunk = []
3030
lines.each { |lineno, line|
3131
stripped = line.strip()
32-
if (stripped == '') or stripped.starts_with?('#')
32+
if (stripped == '') or stripped.start_with?('#')
3333
if chunk.length > 0
3434
chunks << chunk
3535
chunk = []

test/test_discover.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ def fetch(url, body=nil, headers=nil, limit=nil)
526526
"mean to do that.")
527527
end
528528

529-
if xri.starts_with?('/')
529+
if xri.start_with?('/')
530530
xri = xri[1..-1]
531531
end
532532

test/test_discovery_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def test_destroy_manager
230230
end
231231

232232
def test_session_key
233-
assert(@manager.session_key.ends_with?(
233+
assert(@manager.session_key.end_with?(
234234
@manager.instance_variable_get("@session_key_suffix")))
235235
end
236236

test/test_extras.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ def test_starts_with
66
["something else", ""],
77
["", ""],
88
["foos", "foo"],
9-
].each{|str,target| assert(str.starts_with?(target))}
9+
].each{|str,target| assert(str.start_with?(target))}
1010
end
1111

1212
def test_not_starts_with
1313
[["x", "y"],
1414
["foos", "ball"],
1515
["xx", "xy"],
16-
].each{|str,target| assert(!(str.starts_with? target)) }
16+
].each{|str,target| assert(!(str.start_with? target)) }
1717
end
1818

1919
def test_ends_with
2020
[["anything", ""],
2121
["something else", " else"],
2222
["", ""],
2323
["foos", "oos"],
24-
].each{|str,target| assert(str.ends_with?(target))}
24+
].each{|str,target| assert(str.end_with?(target))}
2525
end
2626

2727
def test_not_ends_with
2828
[["x", "y"],
2929
["foos", "ball"],
3030
["xx", "xy"],
3131
["foosball", "foosbal"],
32-
].each{|str,target| assert(!(str.ends_with? target)) }
32+
].each{|str,target| assert(!(str.end_with? target)) }
3333
end
3434
end

test/test_server.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ def test_id_res
832832
assert(webresponse.headers.member?('location'))
833833

834834
location = webresponse.headers['location']
835-
assert(location.starts_with?(request.return_to),
835+
assert(location.start_with?(request.return_to),
836836
sprintf("%s does not start with %s",
837837
location, request.return_to))
838838
# argh.
@@ -1247,7 +1247,7 @@ def test_immediate_encode_to_url
12471247
server_url = "http://server.com/server"
12481248

12491249
url = @request.encode_to_url(server_url)
1250-
assert(url.starts_with?(server_url))
1250+
assert(url.start_with?(server_url))
12511251

12521252
unused, query = url.split("?", 2)
12531253
args = Util.parse_query(query)
@@ -1430,7 +1430,7 @@ def test_answerImmediateDenyOpenID1
14301430
assert_equal('id_res', answer.fields.get_arg(OPENID_NS, 'mode'))
14311431

14321432
usu = answer.fields.get_arg(OPENID_NS, 'user_setup_url', '')
1433-
assert(usu.starts_with?(server_url))
1433+
assert(usu.start_with?(server_url))
14341434
expected_substr = 'openid.claimed_id=http%3A%2F%2Fclaimed-id.test%2F'
14351435
assert(!usu.index(expected_substr).nil?, usu)
14361436
end

test/testutil.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def assert_protocol_error(str_prefix)
5252
rescue ProtocolError => why
5353
message = "Expected prefix #{str_prefix.inspect}, got "\
5454
"#{why.message.inspect}"
55-
assert(why.message.starts_with?(str_prefix), message)
55+
assert(why.message.start_with?(str_prefix), message)
5656
else
5757
fail("Expected ProtocolError. Got #{result.inspect}")
5858
end

0 commit comments

Comments
 (0)