Sha256: 85c1414605e7138a7ee20cf73e6c15a05ab82977ad84a7c2742f3c7b6f00a06b

Contents?: true

Size: 282 Bytes

Versions: 2

Compression:

Stored size: 282 Bytes

Contents

module Yaks
  module FP

    class Updatable < Module
      def initialize(*attributes)
        define_method :update do |updates|
          self.class.new(
            *attributes.map {|attr| updates.fetch(attr) { send(attr) }}
          )
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yaks-0.4.4 lib/yaks/fp/updatable.rb
yaks-0.4.3 lib/yaks/fp/updatable.rb