lib/guillotine/adapters/cassandra_adapter.rb
# Public: Stores the shortened version of a URL.
#
# url     - The String URL to shorten and store.
# code    - Optional String code for the URL.
# options - Optional Guillotine::Service::Options
#
# Returns the unique String code for the URL.  If the URL is added
# multiple times, this should return the same code.
Stores the shortened version of a URL.
url     - The String URL to shorten and store.
code    - Optional String code for the URL.
options - Optional Guillotine::Service::Options

Returns the unique String code for the URL.  If the URL is added
multiple times, this should return the same code.
Stores the shortened version of a URL . url - The String URL to shorten and store . code - Optional String code for the URL . options - Optional Guillotine :: Service :: Options Returns the unique String code for the URL . If the URL is added multiple times this should return the same code .
def add(url, code = nil, options = nil)
      return if @read_only
      if existing_code = code_for(url)
        existing_code
      else
        code = get_code(url, code, options)
        if existing_url = find(code)
          raise DuplicateCodeError.new(existing_url, url, code) if url != existing_url
        end
        @cassandra.insert("codes", code, 'url' => url)
        @cassandra.insert("urls", url, 'code' => code)
        code
      end
    end
def add ( url , code = nil , options = nil ) return if @read_only if existing_code = code_for ( url ) existing_code else code = get_code ( url , code , options ) if existing_url = find ( code ) raise DuplicateCodeError . new ( existing_url , url , code ) if url != existing_url end @cassandra . insert ( "codes" , code , 'url' => url ) @cassandra . insert ( "urls" , url , 'code' => code ) code end end
Public: Stores the shortened version of a URL.
Public : Stores the shortened version of a URL .
url
<not_specific>
code
<not_specific>
options
<not_specific>