class UrlExpander::Expanders::API

Attributes

long_url[RW]
parent_klass[R]
parttern[R]
shortner_key[R]

Public Class Methods

new(short_url="", options={}) click to toggle source

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+'

# File lib/url_expander/expanders/api.rb, line 12
def initialize(short_url="", options={})
  if short_url.match(parent_klass.class::PATTERN)
    @shortner_key = $2
  else
    raise 'invalid pattern'
  end
end