Skip to content

Commit

Permalink
Switch back to attributes for BlockInit
Browse files Browse the repository at this point in the history
as the kwargs version would cause issues with Ruby 3
  • Loading branch information
julik committed Mar 7, 2021
1 parent 74a8bc7 commit c0fa993
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tracksperanto/block_init.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Implements the conventional constructor with "hash of attributes" and block support
module Tracksperanto::BlockInit
def initialize(**object_attribute_hash)
object_attribute_hash.map { |(k, v)| public_send("#{k}=", v) }
def initialize(attributes = {})
attributes.map { |(k, v)| public_send("#{k}=", v) }
yield(self) if block_given?
end
end

0 comments on commit c0fa993

Please sign in to comment.