Class: Raven::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/raven/interfaces.rb

Overview

rubocop:disable Style/MutableConstant

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = nil) {|_self| ... } ⇒ Interface

Returns a new instance of Interface.

Yields:

  • (_self)

Yield Parameters:



7
8
9
10
11
12
13
# File 'lib/raven/interfaces.rb', line 7

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

  yield self if block_given?
end

Class Method Details

.name(value = nil) ⇒ Object



15
16
17
# File 'lib/raven/interfaces.rb', line 15

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

Instance Method Details

#to_hashObject



19
20
21
# File 'lib/raven/interfaces.rb', line 19

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