lib/raven/interfaces.rb in sentry-raven-0.12.3 vs lib/raven/interfaces.rb in sentry-raven-0.13.0
- old
+ new
@@ -1,24 +1,23 @@
-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
+ public_send "#{attr}=", value
end if attributes
yield self if block_given?
end
def self.name(value = nil)
@interface_name ||= value
+ end
+
+ def to_hash
+ Hash[instance_variables.map { |name| [name[1..-1].to_sym, instance_variable_get(name)] } ]
end
end
def self.register_interface(mapping)
mapping.each_pair do |key, klass|