Class: HTTPAccess2::Site
- Inherits:
-
Object
- Object
- HTTPAccess2::Site
- Defined in:
- lib/rss-client/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.
1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 |
# File 'lib/rss-client/http-access2.rb', line 1182 def initialize(uri = nil) if uri @uri = uri @scheme = uri.scheme @host = uri.host @port = uri.port.to_i else @uri = nil @scheme = 'tcp' @host = '0.0.0.0' @port = 0 end end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
1179 1180 1181 |
# File 'lib/rss-client/http-access2.rb', line 1179 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
1180 1181 1182 |
# File 'lib/rss-client/http-access2.rb', line 1180 def port @port end |
#scheme ⇒ Object
:nodoc:
1178 1179 1180 |
# File 'lib/rss-client/http-access2.rb', line 1178 def scheme @scheme end |
Instance Method Details
#==(rhs) ⇒ Object
1204 1205 1206 1207 1208 1209 1210 |
# File 'lib/rss-client/http-access2.rb', line 1204 def ==(rhs) if rhs.is_a?(Site) ((@scheme == rhs.scheme) and (@host == rhs.host) and (@port == rhs.port)) else false end end |
#addr ⇒ Object
1196 1197 1198 |
# File 'lib/rss-client/http-access2.rb', line 1196 def addr "#{@scheme}://#{@host}:#{@port.to_s}" end |
#inspect ⇒ Object
1216 1217 1218 |
# File 'lib/rss-client/http-access2.rb', line 1216 def inspect sprintf("#<%s:0x%x %s>", self.class.name, __id__, @uri || addr) end |
#to_s ⇒ Object
1212 1213 1214 |
# File 'lib/rss-client/http-access2.rb', line 1212 def to_s addr end |