Class: Nanny::MagnetURI
- Inherits:
-
Object
- Object
- Nanny::MagnetURI
- Defined in:
- lib/nanny/magnet_uri.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(uri) ⇒ MagnetURI
constructor
A new instance of MagnetURI.
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
#uri ⇒ Object (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
#hash ⇒ Object
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 |