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)



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

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

#to_uri_template(options = {}) ⇒ Object

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



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

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