Sha256: 31e810a7dee9846110b9914190d189fc98b0b30284dc1cf510e4fb10e53b34cd

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

module Saddle::ClientAttributes

  def self.included(obj)
    obj.extend ClassMethods

    # Clone the parent's additional_middlewares
    obj.additional_middlewares = if defined?(obj.superclass.additional_middlewares)
      obj.superclass.additional_middlewares.clone
    else
      []
    end

    # We know that this module is included when saddle client is inherited,
    # so we're actually interested in the path of the caller two levels deep.
    path, = caller[2].partition(":")
    obj.implementation_root = File.dirname(path)
  end

  module ClassMethods
    attr_accessor :implementation_root
    attr_accessor :additional_middlewares
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
saddle-0.0.12 lib/saddle/client_attributes.rb