Class: Shorty::Url
- Inherits:
-
Object
- Object
- Shorty::Url
- Includes:
- DataMapper::Resource
- Defined in:
- lib/shorty/models/url.rb
Constant Summary collapse
- IPv4_PART =
0-255
/\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/
- URL_REGEXP =
%r{ \A https?:// # http:// or https:// ([^\s:@]+:[^\s:@]*@)? # optional username:pw@ ( (xn--)?[^\W_]+([-.][^\W_]+)*\.[a-z]{2,6}\.? | # domain (including Punycode/IDN)... #{IPv4_PART}(\.#{IPv4_PART}){3} ) # or IPv4 (:\d{1,5})? # optional port ([/?]\S*)? # optional /whatever or ?whatever \Z }iux
Class Method Summary collapse
Class Method Details
.path_size ⇒ Object
33 34 35 |
# File 'lib/shorty/models/url.rb', line 33 def self.path_size 8 end |
.random_path ⇒ Object
29 30 31 |
# File 'lib/shorty/models/url.rb', line 29 def self.random_path Anybase::Base62.random(path_size) end |