class Object

Public Instance Methods

Smooth(api_or_resource_name = nil) click to toggle source

Provides a global helper for looking up things in the Smooth object system.

Example:

Smooth() #=> returns the current api
Smooth('books') #=> returns the books resource
Smooth('books.create') #=> returns the create command, for the books resource
# File lib/smooth.rb, line 236
def Smooth(api_or_resource_name = nil)
  return Smooth.current_api if api_or_resource_name.nil?

  if api_or_resource_name.to_s.include?(Smooth.config.object_path_separator)
    return Smooth.current_api.lookup_object_by(api_or_resource_name)
  end

  Smooth.fetch_api(api_or_resource_name) || Smooth.current_api.resource(api_or_resource_name)
end