Sha256: b73bc8ee16d11d8c851d37ffe43991f06461e9e7cfcc2a717b5d8926e33be422

Contents?: true

Size: 583 Bytes

Versions: 7

Compression:

Stored size: 583 Bytes

Contents

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

      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

7 entries across 7 versions & 1 rubygems

Version Path
sentry-raven-3.1.2 lib/raven/interface.rb
sentry-raven-3.1.1 lib/raven/interface.rb
sentry-raven-3.1.0 lib/raven/interface.rb
sentry-raven-3.0.4 lib/raven/interface.rb
sentry-raven-3.0.3 lib/raven/interface.rb
sentry-raven-3.0.2 lib/raven/interface.rb
sentry-raven-3.0.1 lib/raven/interface.rb