module ForwardSlash

Constants

VERSION

Public Class Methods

included(base) click to toggle source
# File lib/forward_slash.rb, line 6
def self.included(base)
  base.send(:attr_reader, :result)
  base.define_singleton_method(:result) do
    @result
  end

  base.extend self
end

Public Instance Methods

http(url) click to toggle source
# File lib/forward_slash.rb, line 15
def http(url)
  result = Net::HTTP.get(URI("http://#{url.part}"))
  calling_object = binding.of_caller(1).receiver
  calling_object.instance_variable_set(:@result, result)
end
https(url) click to toggle source
# File lib/forward_slash.rb, line 21
def https(url)
  result = Net::HTTP.get(URI("https://#{url.part}"))
  calling_object = binding.of_caller(1).receiver
  calling_object.instance_variable_set(:@result, result)
end
method_missing(part, *args) click to toggle source
# File lib/forward_slash.rb, line 27
def method_missing(part, *args)
  DomainPart.new(part.to_s)
end