module Jaleb::Model

Autoload Models

Public Class Methods

identify(url) click to toggle source

Detect model by url

# File lib/jaleb/model.rb, line 5
def identify(url)
  if url =~ ::URI.regexp
    uri = ::URI::parse(url)
    host = uri.host
    match_model = nil 
     for model in Jaleb.model_classes 
       match_model = model if host =~ model.regexp
     end
     return match_model

  else
    raise AgrumentError , "not a url"
  end
end