class Raven::Interface

Public Class Methods

inherited(klass) click to toggle source
Calls superclass method
# File lib/raven/interface.rb, line 11
def self.inherited(klass)
  name = klass.name.split("::").last.downcase.gsub("interface", "")
  registered[name.to_sym] = klass
  super
end
new(attributes = nil) { |self| ... } click to toggle source
# File lib/raven/interface.rb, line 3
def initialize(attributes = nil)
  attributes&.each do |attr, value|
    public_send "#{attr}=", value
  end

  yield self if block_given?
end
registered() click to toggle source
# File lib/raven/interface.rb, line 17
def self.registered
  @@registered ||= {} # rubocop:disable Style/ClassVars
end

Public Instance Methods

to_hash() click to toggle source
# File lib/raven/interface.rb, line 21
def to_hash
  Hash[instance_variables.map { |name| [name[1..-1].to_sym, instance_variable_get(name)] }]
end