Module: Smooth::Util

Extended by:
Util
Included in:
Util
Defined in:
lib/smooth/util.rb

Instance Method Summary collapse

Instance Method Details

#expand_url_template(uri_template, vars = {}) ⇒ Object



9
10
11
# File 'lib/smooth/util.rb', line 9

def expand_url_template(uri_template, vars = {})
  uri_template.expand(vars)
end

#extract_url_vars(uri_template, actual_url) ⇒ Object



13
14
15
# File 'lib/smooth/util.rb', line 13

def extract_url_vars(uri_template, actual_url)
  uri_template.extract(actual_url).tap(&:symbolize_keys!)
end

#uri_template(url_pattern) ⇒ Object



5
6
7
# File 'lib/smooth/util.rb', line 5

def uri_template(url_pattern)
  URITemplate.new(:colon, url_pattern)
end