Class: Nanny::MagnetURI

Inherits:
Object
  • Object
show all
Defined in:
lib/nanny/magnet_uri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ MagnetURI

Returns a new instance of MagnetURI.



5
6
7
# File 'lib/nanny/magnet_uri.rb', line 5

def initialize(uri)
  @uri = uri
end

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



3
4
5
# File 'lib/nanny/magnet_uri.rb', line 3

def uri
  @uri
end

Instance Method Details

#hashObject



9
10
11
# File 'lib/nanny/magnet_uri.rb', line 9

def hash
  uri.match(/xt=urn:btih:(?<hash>[a-z0-9]+)/i)["hash"]
end