Sha256: 24fb30311c7cac9d00bb1c16ce5e249177425ef67d160380e00ebea5f5a5cbcf

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

module Rapidash
  module Urlable

    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods
      def url(url)
        self.class_eval do
          define_method(:initialize) do |*args|
            @client, id, options = args
            if id.is_a?(Hash)
              options = id
              id = nil
            end
            @options ||= {}
            options ||= {}
            @options.merge!(options)
            @url = url.to_s
            @url += "/#{id}" if id
          end
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapidash-0.0.1 lib/rapidash/urlable.rb