Sha256: b97c13f774653e771ab16c32fe438658d146e8e5e8e3f944cd9b75af369ba788

Contents?: true

Size: 644 Bytes

Versions: 8

Compression:

Stored size: 644 Bytes

Contents

require 'raven/better_attr_accessor'

module Raven

  INTERFACES = {}

  class Interface
    include BetterAttrAccessor
    alias_method :to_hash, :attributes

    def initialize(attributes = nil)
      attributes.each do |attr, value|
        send "#{attr}=", value
      end if attributes

      yield self if block_given?
    end

    def self.name(value = nil)
      @interface_name ||= value
    end
  end

  def self.register_interface(mapping)
    mapping.each_pair do |key, klass|
      INTERFACES[key.to_s] = klass
      INTERFACES[klass.name] = klass
    end
  end

  def self.find_interface(name)
    INTERFACES[name.to_s]
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
sentry-raven-0.12.3 lib/raven/interfaces.rb
sentry-raven-0.12.2 lib/raven/interfaces.rb
sentry-raven-0.12.1 lib/raven/interfaces.rb
sentry-raven-0.12.0 lib/raven/interfaces.rb
mustwin-sentry-raven-0.11.2 lib/raven/interfaces.rb
sentry-raven-0.11.2 lib/raven/interfaces.rb
sentry-raven-0.11.1 lib/raven/interfaces.rb
sentry-raven-0.10.1 lib/raven/interfaces.rb