Class: Swagger::Data::Url
- Inherits:
-
Object
- Object
- Swagger::Data::Url
- Defined in:
- lib/ruby-swagger/data/url.rb
Constant Summary collapse
- SCHEMES =
%w(http https)
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ Url
constructor
A new instance of Url.
- #to_swagger ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ Url
Returns a new instance of Url.
10 11 12 |
# File 'lib/ruby-swagger/data/url.rb', line 10 def initialize(url) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/ruby-swagger/data/url.rb', line 8 def url @url end |
Instance Method Details
#to_swagger ⇒ Object
21 22 23 |
# File 'lib/ruby-swagger/data/url.rb', line 21 def to_swagger url end |
#valid? ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/ruby-swagger/data/url.rb', line 14 def valid? parsed = Addressable::URI.parse(url) or return false SCHEMES.include?(parsed.scheme) rescue Addressable::URI::InvalidURIError false end |