Class: UrlExpander::Expanders::API
- Inherits:
-
Object
- Object
- UrlExpander::Expanders::API
- Defined in:
- lib/url_expander/expanders/api.rb
Instance Attribute Summary collapse
-
#long_url ⇒ Object
Returns the value of attribute long_url.
-
#parent_klass ⇒ Object
readonly
Returns the value of attribute parent_klass.
-
#parttern ⇒ Object
readonly
Returns the value of attribute parttern.
-
#shortner_key ⇒ Object
readonly
Returns the value of attribute shortner_key.
Instance Method Summary collapse
-
#initialize(short_url = "", options = {}) ⇒ API
constructor
Called from the Subclasses, its only job to set the @shortner_key For example, if the short_url = ‘bit.ly/k3irb0’ then @shortner_key = ‘k3irb0’.
Constructor Details
#initialize(short_url = "", options = {}) ⇒ API
Called from the Subclasses, its only job to set the @shortner_key For example, if the short_url = ‘bit.ly/k3irb0’ then @shortner_key = ‘k3irb0’
12 13 14 15 16 17 18 |
# File 'lib/url_expander/expanders/api.rb', line 12 def initialize(short_url="", ={}) if short_url.match(parent_klass.class::PATTERN) @shortner_key = $2 else raise 'invalid pattern' end end |
Instance Attribute Details
#long_url ⇒ Object
Returns the value of attribute long_url.
6 7 8 |
# File 'lib/url_expander/expanders/api.rb', line 6 def long_url @long_url end |
#parent_klass ⇒ Object (readonly)
Returns the value of attribute parent_klass.
7 8 9 |
# File 'lib/url_expander/expanders/api.rb', line 7 def parent_klass @parent_klass end |
#parttern ⇒ Object (readonly)
Returns the value of attribute parttern.
7 8 9 |
# File 'lib/url_expander/expanders/api.rb', line 7 def parttern @parttern end |
#shortner_key ⇒ Object (readonly)
Returns the value of attribute shortner_key.
7 8 9 |
# File 'lib/url_expander/expanders/api.rb', line 7 def shortner_key @shortner_key end |