Class: RubyTorrent::TrackerResponsePeer
- Inherits:
-
Object
- Object
- RubyTorrent::TrackerResponsePeer
show all
- Defined in:
- lib/rubytorrent/tracker.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TrackerResponsePeer.
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/rubytorrent/tracker.rb', line 41
def initialize(dict=nil)
@s = TypedStruct.new do |s|
s.field :peer_id => String, :ip => String, :port => Integer
s.required :ip, :port
s.label :peer_id => "peer id"
end
@s.parse(dict) unless dict.nil?
@connected = false
@tried = false
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
55
56
57
|
# File 'lib/rubytorrent/tracker.rb', line 55
def method_missing(meth, *args)
@s.send(meth, *args)
end
|
Instance Attribute Details
#tried=(value) ⇒ Object
39
40
41
|
# File 'lib/rubytorrent/tracker.rb', line 39
def tried=(value)
@tried = value
end
|
Instance Method Details
#==(o) ⇒ Object
59
|
# File 'lib/rubytorrent/tracker.rb', line 59
def ==(o); (self.ip == o.ip) && (self.port == o.port); end
|
#to_s ⇒ Object
61
62
63
|
# File 'lib/rubytorrent/tracker.rb', line 61
def to_s
%{<#{self.class}: ip=#{self.ip}, port=#{self.port}>}
end
|
#tried? ⇒ Boolean
53
|
# File 'lib/rubytorrent/tracker.rb', line 53
def tried?; @tried; end
|