Class: Shortie::BaseShortener
- Inherits:
-
Object
- Object
- Shortie::BaseShortener
- Defined in:
- lib/shortie/base_shortener.rb
Direct Known Subclasses
Shorteners::Bitly, Shorteners::Cligs, Shorteners::Cllk, Shorteners::Idek, Shorteners::Isgd, Shorteners::Lns, Shorteners::Metamark, Shorteners::Minilink, Shorteners::Rubyurl, Shorteners::Shortie, Shorteners::Snim, Shorteners::Snipr, Shorteners::Snipurl, Shorteners::Snurl, Shorteners::Tinycc, Shorteners::Tinyurl, Shorteners::Twurl
Instance Attribute Summary collapse
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.shorten(url) ⇒ Object
Shortens a url.
Instance Method Summary collapse
-
#initialize(url) ⇒ BaseShortener
constructor
A new instance of BaseShortener.
-
#shorten ⇒ Object
Shorten method to be called.
Constructor Details
#initialize(url) ⇒ BaseShortener
Returns a new instance of BaseShortener.
10 11 12 |
# File 'lib/shortie/base_shortener.rb', line 10 def initialize(url) self.url = url end |
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/shortie/base_shortener.rb', line 3 def url @url end |
Class Method Details
.shorten(url) ⇒ Object
Shortens a url.
6 7 8 |
# File 'lib/shortie/base_shortener.rb', line 6 def self.shorten(url) self.new(url).shorten end |
Instance Method Details
#shorten ⇒ Object
Shorten method to be called. Must be implemented by classes inheriting this class.
15 16 17 |
# File 'lib/shortie/base_shortener.rb', line 15 def shorten raise "Invalid shortener. It must implement the shorten method." end |