Class: Uri
- Inherits:
-
Object
- Object
- Uri
- Defined in:
- lib/regexpr-uri.rb
Defined Under Namespace
Classes: Flags
Constant Summary collapse
- RegExpr =
::RegExpr[ :scheme => '( "http" | "ftp" ) "s" ? | "sftp" | "fish"', :username => '[^:@]*', :password => '[^@]*', :host => 'hostname | ipv4', :port => 'digit +', :path => '( "/" ? [^?#]* "/" ) ?', :file => '[^/?#] *', :flags => '[^#] *', :fragment => '. *', 'ipv4digits' => '0..255', 'ipv6digits' => '[0-9a-bA-B] {1,4}', 'userinfo' => 'username ( ":" password ) ?', 'domainlabel' => 'alphadigit ( ( alphadigit | "-" ) * alphadigit ) ?', 'hostname' => 'domainlabel ( "." | domainlabel ) *', 'ipv4' => 'ipv4digits ( "." ipv4digits ) {3,3}', 'request_uri' => '( path ? file ) ? ( "?" flags ) ?', 'serv' => 'host ( ":" port ? ) ?', 'pre' => '( ( scheme "://" ) ( auth "@" ) ? serv ) ?', 'uri' => 'pre request_uri ( "#" fragment ) ?', 'main' => 'uri' ]
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#fragment ⇒ Object
Returns the value of attribute fragment.
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#path ⇒ Object
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uri) ⇒ Uri
constructor
A new instance of Uri.
- #pre ⇒ Object
- #serv ⇒ Object
- #to_s ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(uri) ⇒ Uri
Returns a new instance of Uri.
23 |
# File 'lib/regexpr-uri.rb', line 23 def initialize( uri) self. uri= uri end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
22 23 24 |
# File 'lib/regexpr-uri.rb', line 22 def file @file end |
#flags ⇒ Object
Returns the value of attribute flags.
22 23 24 |
# File 'lib/regexpr-uri.rb', line 22 def flags @flags end |
#fragment ⇒ Object
Returns the value of attribute fragment.
22 23 24 |
# File 'lib/regexpr-uri.rb', line 22 def fragment @fragment end |
#host ⇒ Object
Returns the value of attribute host.
22 23 24 |
# File 'lib/regexpr-uri.rb', line 22 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
22 23 24 |
# File 'lib/regexpr-uri.rb', line 22 def password @password end |
#path ⇒ Object
Returns the value of attribute path.
22 23 24 |
# File 'lib/regexpr-uri.rb', line 22 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
22 23 24 |
# File 'lib/regexpr-uri.rb', line 22 def port @port end |
#scheme ⇒ Object
Returns the value of attribute scheme.
22 23 24 |
# File 'lib/regexpr-uri.rb', line 22 def scheme @scheme end |
#username ⇒ Object
Returns the value of attribute username.
22 23 24 |
# File 'lib/regexpr-uri.rb', line 22 def username @username end |
Class Method Details
.new(uri) ⇒ Object
17 18 19 |
# File 'lib/regexpr-uri.rb', line 17 def new uri uri. instance_of?( Uri) ? uri. dup : super( uri) end |
Instance Method Details
#pre ⇒ Object
26 |
# File 'lib/regexpr-uri.rb', line 26 def pre() (self. scheme ? self. scheme+ '://' : '')+ self. serv end |
#serv ⇒ Object
27 |
# File 'lib/regexpr-uri.rb', line 27 def serv() (self. host|| '')+ (self. port ? ':'+ self. port : '') end |
#to_s ⇒ Object
25 |
# File 'lib/regexpr-uri.rb', line 25 def uri() self. pre+ self. uri+ (self. fragment ? '#'+ self. fragment : '') end |
#uri ⇒ Object
24 |
# File 'lib/regexpr-uri.rb', line 24 def uri() self. pre+ self. uri+ (self. fragment ? '#'+ self. fragment : '') end |