module RestUri::Uri

Public Class Methods

find_resource_id(list, &block) click to toggle source

Retrieves REST resource ID @param list [String @param &block [Proc] @return [Integer, NilClass]

# File lib/rest_uri/uri.rb, line 8
def self.find_resource_id(list, &block)
  index = list.index(&block)
  return index if index.nil?
  target = list[index + 1]
  target.nil? ? target : target.to_i
end
hashbang_path_or_path(object) click to toggle source

To support hashbang style URL like twitter.com/#!/status/759813164686938117 @param object [URI] @return [String]

# File lib/rest_uri/uri.rb, line 18
def self.hashbang_path_or_path(object)
  (not object.fragment.nil? and object.fragment.chars.first == '!') ?
      object.fragment :
      object.path
end