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

Commit ff3acd6

Browse files
committed
Merge pull request #62 from tobiashm/master
Removed custom String#starts_with? and #ends_with?
2 parents 05d202c + d804b92 commit ff3acd6

13 files changed

Lines changed: 19 additions & 40 deletions

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/extras.rb

Lines changed: 0 additions & 13 deletions
This file was deleted.

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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
require 'uri'
22

3-
require "openid/extras"
4-
53
module OpenID
64

75
module URINorm
@@ -42,15 +40,15 @@ def URINorm.remove_dot_segments(path)
4240
result_segments = []
4341

4442
while path.length > 0
45-
if path.starts_with?('../')
43+
if path.start_with?('../')
4644
path = path[3..-1]
47-
elsif path.starts_with?('./')
45+
elsif path.start_with?('./')
4846
path = path[2..-1]
49-
elsif path.starts_with?('/./')
47+
elsif path.start_with?('/./')
5048
path = path[2..-1]
5149
elsif path == '/.'
5250
path = '/'
53-
elsif path.starts_with?('/../')
51+
elsif path.start_with?('/../')
5452
path = path[3..-1]
5553
result_segments.pop if result_segments.length > 0
5654
elsif path == '/..'

lib/openid/util.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
require "uri"
33
require "logger"
44

5-
require "openid/extras"
6-
75
# See OpenID::Consumer or OpenID::Server modules, as well as the store classes
86
module OpenID
97
class AssertionError < Exception

test/discoverdata.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
require 'uri'
33
require 'openid/yadis/constants'
44
require 'openid/yadis/discovery'
5-
require 'openid/extras'
65
require 'openid/util'
76

87
module OpenID
@@ -106,7 +105,7 @@ def generateResult(base_url, input_name, id_name, result_name, success)
106105

107106
ctype = nil
108107
header_lines.each { |header_line|
109-
if header_line.starts_with?('Content-Type:')
108+
if header_line.start_with?('Content-Type:')
110109
_, ctype = header_line.split(':', 2)
111110
ctype = ctype.strip()
112111
break

test/test_accept.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require 'minitest/autorun'
22
require 'testutil'
33
require 'openid/yadis/accept'
4-
require 'openid/extras'
54
require 'openid/util'
65

76
module OpenID
@@ -30,7 +29,7 @@ def chunk(lines)
3029
chunk = []
3130
lines.each { |lineno, line|
3231
stripped = line.strip()
33-
if (stripped == '') or stripped.starts_with?('#')
32+
if (stripped == '') or stripped.start_with?('#')
3433
if chunk.length > 0
3534
chunks << chunk
3635
chunk = []

test/test_discover.rb

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

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

test/test_discovery_manager.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require 'minitest/autorun'
22
require 'openid/consumer/discovery_manager'
3-
require 'openid/extras'
43
require 'testutil'
54

65
module OpenID
@@ -234,7 +233,7 @@ def test_destroy_manager
234233
end
235234

236235
def test_session_key
237-
assert(@manager.session_key.ends_with?(
236+
assert(@manager.session_key.end_with?(
238237
@manager.instance_variable_get("@session_key_suffix")))
239238
end
240239

0 commit comments

Comments
 (0)