Class: Stretch::URIBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/stretch/uri_builder.rb

Class Method Summary collapse

Class Method Details

.build_from_scope(scope, path) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/stretch/uri_builder.rb', line 3

def self.build_from_scope scope, path
  path.gsub!(/\A\//, '')

  if scope[:cluster]
    "/_cluster/#{path}"
  elsif scope[:index]
    "/#{scope[:index]}/#{path}"
  end
end