Class: Immutable

Inherits:
Object
  • Object
show all
Defined in:
lib/lygre/gabcscore.rb

Overview

initialized by arguments or by assignment in a block; frozen thereafter

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) {|_self| ... } ⇒ Immutable

Returns a new instance of Immutable.

Yields:

  • (_self)

Yield Parameters:

  • _self (Immutable)

    the object that the method was called on



8
9
10
11
12
13
14
15
16
17
# File 'lib/lygre/gabcscore.rb', line 8

def initialize(args={})
  args.each_pair do |k,v|
    writer = (k.to_s + '=').to_sym
    self.send(writer, v)
  end

  yield self if block_given?

  freeze
end