Module: Snail::Initializable

Included in:
Snail
Defined in:
lib/snail/initializable.rb

Instance Method Summary collapse

Instance Method Details

#initialize(attrs = {}) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



3
4
5
6
7
8
9
10
# File 'lib/snail/initializable.rb', line 3

def initialize(attrs = {})
  attrs.each do |k, v|
    m = "#{k}="
    raise UnknownAttribute, k unless respond_to? m
    send(m, v)
  end
  yield self if block_given?
end