Class: HTTPAccess2::Site
- Inherits:
-
Object
- Object
- HTTPAccess2::Site
- Defined in:
- lib/reap/vendor/http-access2.rb
Overview
HTTPAccess2::Site – manage a site(host and port)
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#scheme ⇒ Object
:nodoc:.
Instance Method Summary collapse
- #==(rhs) ⇒ Object
- #addr ⇒ Object
-
#initialize(uri = nil) ⇒ Site
constructor
A new instance of Site.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(uri = nil) ⇒ Site
Returns a new instance of Site.
751 752 753 754 755 756 757 758 759 760 761 |
# File 'lib/reap/vendor/http-access2.rb', line 751 def initialize(uri = nil) if uri @scheme = uri.scheme @host = uri.host @port = uri.port.to_i else @scheme = 'tcp' @host = '0.0.0.0' @port = 0 end end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
748 749 750 |
# File 'lib/reap/vendor/http-access2.rb', line 748 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
749 750 751 |
# File 'lib/reap/vendor/http-access2.rb', line 749 def port @port end |
#scheme ⇒ Object
:nodoc:
747 748 749 |
# File 'lib/reap/vendor/http-access2.rb', line 747 def scheme @scheme end |
Instance Method Details
#==(rhs) ⇒ Object
771 772 773 774 775 776 777 |
# File 'lib/reap/vendor/http-access2.rb', line 771 def ==(rhs) if rhs.is_a?(Site) ((@scheme == rhs.scheme) and (@host == rhs.host) and (@port == rhs.port)) else false end end |
#addr ⇒ Object
763 764 765 |
# File 'lib/reap/vendor/http-access2.rb', line 763 def addr "#{@scheme}://#{@host}:#{@port.to_s}" end |
#inspect ⇒ Object
783 784 785 |
# File 'lib/reap/vendor/http-access2.rb', line 783 def inspect sprintf("#<%s:0x%x %s>", self.class.name, __id__, addr) end |
#to_s ⇒ Object
779 780 781 |
# File 'lib/reap/vendor/http-access2.rb', line 779 def to_s addr end |