Sha256: 0e9536c8aeee83c4e03f01085a881c2fb673f0af91c86d0f99924f77679a2760

Contents?: true

Size: 457 Bytes

Versions: 3

Compression:

Stored size: 457 Bytes

Contents

# frozen_string_literal: true

module Micro::Attributes
  module Features
    module Initialize
      def self.included(base)
        base.send(:include, ::Micro::Attributes)
      end

      def initialize(arg)
        self.attributes = arg
      end

      def with_attribute(key, val)
        self.class.new(attributes.merge(key => val))
      end

      def with_attributes(arg)
        self.class.new(attributes.merge(arg))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
u-attributes-0.12.0 lib/micro/attributes/features/initialize.rb
u-attributes-0.11.0 lib/micro/attributes/features/initialize.rb
u-attributes-0.10.0 lib/micro/attributes/features/initialize.rb