Sha256: 103a134d76dc7229a92d7b7cc4e0058c17e225e91f06c971560615d64fcd3087

Contents?: true

Size: 448 Bytes

Versions: 4

Compression:

Stored size: 448 Bytes

Contents

# frozen_string_literal: true

module Micro::Attributes
  module Features
    module Initialize
      def self.included(base)
        base.class_eval(<<-RUBY)
          def initialize(arg)
            self.attributes = arg
          end
        RUBY
      end

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

      def with_attribute(key, val)
        with_attributes(key => val)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
u-attributes-2.8.0 lib/micro/attributes/features/initialize.rb
u-attributes-2.7.0 lib/micro/attributes/features/initialize.rb
u-attributes-2.6.0 lib/micro/attributes/features/initialize.rb
u-attributes-2.5.0 lib/micro/attributes/features/initialize.rb