Sha256: 196f9681f27ef6d0e867b19100121c287378b32d3584df9267189a7ae46cfd47

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

# coding: utf-8
# frozen_string_literal: true

################################################
# © Alexander Semyonov, 2011—2013, MIT License #
# Author: Alexander Semyonov <al@semyonov.us>  #
################################################

require 'xommelier'
require 'xommelier/core_ext/string'
require 'uri'

class URI::Generic
  def to_xommelier
    to_s
  end
end

class Uri < String
  def self.from_xommelier(value)
    return if value.nil?
    case value
    when URI::Generic
      value
    when String
      URI.parse(value)
    else
      raise Xommelier::TypeError.new(value, Uri)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xommelier-0.1.34 lib/xommelier/core_ext/uri.rb
xommelier-0.1.33 lib/xommelier/core_ext/uri.rb