Class: Iz::Url
- Inherits:
-
Object
- Object
- Iz::Url
- Defined in:
- lib/iz/url.rb
Constant Summary collapse
- REGEX =
/^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/i
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(url) ⇒ Url
constructor
A new instance of Url.
- #valid? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ Url
Returns a new instance of Url.
7 8 9 |
# File 'lib/iz/url.rb', line 7 def initialize(url) self.value = url end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/iz/url.rb', line 5 def value @value end |
Class Method Details
.is_url?(value) ⇒ Boolean
15 16 17 18 |
# File 'lib/iz/url.rb', line 15 def self.is_url?(value) return false unless value value.to_s =~ REGEX end |