Module: TooShort

Defined in:
lib/too_short.rb,
lib/ar_base_extensions.rb,
lib/controller_methods.rb

Defined Under Namespace

Modules: ARBaseExtensions, ControllerMethods, InstanceMethods Classes: ClassRegistry, TooShortInvalidOptionError, TooShortMissingOptionError

Constant Summary collapse

BASE =
36

Class Method Summary collapse

Class Method Details

.expand_to_object(class_scope, hash) ⇒ Object

Used to translate the given hash (and scope) into an object class_scope is optional.



20
21
22
23
24
# File 'lib/too_short.rb', line 20

def self.expand_to_object(class_scope, hash)
  klass = short_url_klass class_scope
  id = hash_to_id hash
  klass.find_by_id(id) if klass and id
end

.optionsObject

Options are: <em>host<em>: The short URL host you wish to use, i.e. 2sh.de (required)



14
15
16
# File 'lib/too_short.rb', line 14

def self.options
  @options ||= {}
end

.register_class(class_name, class_scope) ⇒ Object



26
27
28
# File 'lib/too_short.rb', line 26

def self.register_class(class_name, class_scope)
  ClassRegistry.instance.register(class_name, class_scope)
end