Sha256: 446c5a026fa966610b0f18234de95a710da7e543d02ea862f3384361691a8679

Contents?: true

Size: 583 Bytes

Versions: 15

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true

module Contracts
  module Attrs
    def attr_reader_with_contract(*names, contract)
      names.each do |name|
        Contract Contracts::None => contract
        attr_reader(name)
      end
    end

    def attr_writer_with_contract(*names, contract)
      names.each do |name|
        Contract contract => contract
        attr_writer(name)
      end
    end

    def attr_accessor_with_contract(*names, contract)
      attr_reader_with_contract(*names, contract)
      attr_writer_with_contract(*names, contract)
    end
  end

  include Attrs
end

Version data entries

15 entries across 15 versions & 5 rubygems

Version Path
contracts-0.17.2 lib/contracts/attrs.rb
contracts-0.17.1 lib/contracts/attrs.rb
entitlements-app-1.1.0 lib/contracts-ruby3/lib/contracts/attrs.rb
entitlements-app-1.0.0 lib/contracts-ruby3/lib/contracts/attrs.rb
entitlements-app-0.3.4 lib/contracts-ruby3/lib/contracts/attrs.rb
entitlements-app-0.3.1 lib/contracts-ruby3/lib/contracts/attrs.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/contracts-0.17/lib/contracts/attrs.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/contracts-0.17/lib/contracts/attrs.rb
entitlements-app-0.3.0 lib/contracts-ruby3/lib/contracts/attrs.rb
entitlements-0.2.1 lib/contracts-ruby3/lib/contracts/attrs.rb
entitlements-app-0.2.1 lib/contracts-ruby3/lib/contracts/attrs.rb
entitlements-0.2.0 lib/contracts-ruby3/lib/contracts/attrs.rb
entitlements-app-0.2.0 lib/contracts-ruby3/lib/contracts/attrs.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/contracts-0.17/lib/contracts/attrs.rb
contracts-0.17 lib/contracts/attrs.rb