module Upyun::Utils

Public Class Methods

included(receiver) click to toggle source
# File lib/upyun/utils.rb, line 9
def self.included(receiver)
  receiver.send(:define_method, :endpoint) { @endpoint }
  receiver.send(:define_method, :endpoint=) do |ep|
    unless Upyun::ED_LIST.member?(ep)
      raise ArgumentError, "Valid endpoints are: #{Upyun::ED_LIST}"
    end
    @endpoint = ep
  end
end

Public Instance Methods

md5(str) click to toggle source
# File lib/upyun/utils.rb, line 5
def md5(str)
  Digest::MD5.hexdigest(str)
end