Class: Raven::Interface

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

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:



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

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



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

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

Instance Method Details

#to_hashObject



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

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