Class: DynamicLinks::ShorteningStrategies::BaseStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamic_links/shortening_strategies/base_strategy.rb

Constant Summary collapse

MIN_LENGTH =
5
BASE62_CHARS =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".freeze

Instance Method Summary collapse

Instance Method Details

#always_growing?Boolean

Determines if the strategy always generates a new shortened URL

Returns:

  • (Boolean)


14
15
16
# File 'lib/dynamic_links/shortening_strategies/base_strategy.rb', line 14

def always_growing?
  false  # Default behavior is not to always grow
end

#shorten(url) ⇒ Object

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/dynamic_links/shortening_strategies/base_strategy.rb', line 8

def shorten(url)
  raise NotImplementedError, "You must implement the shorten method"
end