Module: Gearhead::Utils

Defined in:
lib/gearhead/utils.rb

Class Method Summary collapse

Class Method Details

.check_endpoint!(endpoint) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/gearhead/utils.rb', line 5

def check_endpoint!(endpoint)
  return if endpoint.start_with?("/") && !endpoint.end_with?("/")
  unless endpoint.start_with?("/")
    raise ArgumentError, "Endpoint must start with /. Endpoint is: `#{endpoint}'"
  end
  if endpoint.end_with?("/")
    raise ArgumentError, "Endpoint must not end with /. Endpoint is: `#{endpoint}'"
  end
end