Issue #14411 has been updated by artur86 (Artur Artur).


shevegen (Robert A. Heiler) wrote:
> I think this may be a good suggestion, assuming that there is no simpler
> API.
> 
> The examples on stackoverflow seem very verbose which is often not a
> good sign - either the documentation is not good so people can not
> find a shorter variant; or no shorter variant exists.
> 
> So .secure? seems good to me.
> 
> You may have to get someone from the ruby core team and/or matz to 
> give the go-ahead for the API proposal.
> 
> If I understand it correctly the method will return a boolean result
> (true/false), and the only check that can yield true is if the URI
> scheme uses https, right? (I am just asking in the event that the
> method is to be added, so that people can also add documentation 
> and the desired behaviour to it.)

Thank you for your feedback, Robert! You got it absolutely right in terms of implementation. Base class might always return false, whereas HTTPS class should return true.

I would be happy to implement it.

P.S. I am totally new to contributing to Ruby/Rails


----------------------------------------
Feature #14411: URI#secure?
https://bugs.ruby-lang.org/issues/14411#change-69905

* Author: artur86 (Artur Artur)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I wonder if some predicate method (say #secure?) could be added to URI::Generic class. Currently the only way to query if uri is secure is:

~~~ ruby
uri.instance_of?(URI::HTTPS)
~~~

Inspired by this question: https://stackoverflow.com/questions/2212735/ruby-checking-if-uri-is-https



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>