Module: Wrest::CoreExt::String::Conversions

Included in:
String
Defined in:
lib/wrest/core_ext/string/conversions.rb

Overview

Makes it easier to build other objects from a String This module is opt-out - if you don’t want the to_uri and to_uri_template convenience method on String, set the NoStringExtensions constant on the Wrest module before requiring wrest.

module Wrest
  NoStringExtensions = true
end
require 'wrest'

Instance Method Summary collapse

Instance Method Details

#to_uri(options = {}) ⇒ Object

A convenience method equivalent to Wrest::Uri.new(string)



27
28
29
# File 'lib/wrest/core_ext/string/conversions.rb', line 27

def to_uri(options = {})
  Wrest::Uri.new(strip, options)
end

#to_uri_template(options = {}) ⇒ Object

A convenience method equivalent to Wrest:UriTemplate.new(uri_pattern)



32
33
34
# File 'lib/wrest/core_ext/string/conversions.rb', line 32

def to_uri_template(options = {})
  Wrest::UriTemplate.new(strip, options)
end