lib/rodauth/features/oauth_http_mac.rb in rodauth-oauth-0.3.0 vs lib/rodauth/features/oauth_http_mac.rb in rodauth-oauth-0.4.0
- old
+ new
@@ -6,23 +6,19 @@
module PrefixExtensions
refine(String) do
def delete_suffix(suffix)
suffix = suffix.to_s
len = suffix.length
- if len.positive? && index(suffix, -len)
- self[0...-len]
- else
- dup
- end
+ return dup unless len.positive? && index(suffix, -len)
+
+ self[0...-len]
end
def delete_prefix(prefix)
prefix = prefix.to_s
- if rindex(prefix, 0)
- self[prefix.length..-1]
- else
- dup
- end
+ return dup unless rindex(prefix, 0)
+
+ self[prefix.length..-1]
end
end
end
using(PrefixExtensions)
end