Sha256: 0d1850fb914815192d77f6c148a6981169064758c7cf057b719c6cadbe8ff9fe

Contents?: true

Size: 596 Bytes

Versions: 36

Compression:

Stored size: 596 Bytes

Contents

module Raven
  class Interface
    def initialize(attributes = nil)
      attributes.each do |attr, value|
        public_send "#{attr}=", value
      end if attributes

      yield self if block_given?
    end

    def self.inherited(klass)
      name = klass.name.split("::").last.downcase.gsub("interface", "")
      registered[name.to_sym] = klass
      super
    end

    def self.registered
      @@registered ||= {} # rubocop:disable Style/ClassVars
    end

    def to_hash
      Hash[instance_variables.map { |name| [name[1..-1].to_sym, instance_variable_get(name)] }]
    end
  end
end

Version data entries

36 entries across 36 versions & 3 rubygems

Version Path
sentry-raven-2.6.2 lib/raven/interface.rb
sentry-raven-2.6.1 lib/raven/interface.rb
sentry-raven-2.6.0 lib/raven/interface.rb
sentry-raven-2.5.3 lib/raven/interface.rb
sentry-raven-2.5.2 lib/raven/interface.rb
sentry-raven-2.5.1 lib/raven/interface.rb
sentry-raven-2.5.0 lib/raven/interface.rb
sentry-raven-2.4.0 lib/raven/interface.rb
sentry-raven-2.3.1 lib/raven/interface.rb
sentry-raven-2.3.0 lib/raven/interface.rb
sentry-raven-2.2.0 lib/raven/interface.rb
sentry-raven-2.1.4 lib/raven/interface.rb
sentry-raven-2.1.3 lib/raven/interface.rb
sentry-raven-2.1.2 lib/raven/interface.rb
sentry-raven-2.1.1 lib/raven/interface.rb
sentry-raven-2.1.0 lib/raven/interface.rb