# \[dry-monads\] Including \`Do::All\` makes every methods publicly available

**URL:** <https://discourse.dry-rb.org/t/dry-monads-including-do-all-makes-every-methods-publicly-available/1047>\
**Category:** Support\
**Created:** [April 26, 2020, 10:36pm UTC](https://discourse.dry-rb.org/t/dry-monads-including-do-all-makes-every-methods-publicly-available/1047 "2020-04-26T22:36:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WojciechKo](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/wojciechko/32/354_2.png) [@WojciechKo](https://discourse.dry-rb.org/u/WojciechKo)\
**Post date:** [April 26, 2020, 10:36pm UTC](https://discourse.dry-rb.org/t/dry-monads-including-do-all-makes-every-methods-publicly-available/1047/1 "2020-04-26T22:36:58Z")

</div>

I’ve noticed that when you include `Do::All` module into a class it makes every methods defined in this class publicly available. Is it a bug or intentional behaviour?

Consider following example:  
[GitHub Gist](https://gist.github.com/WojciechKo/d40cf9b040b25e287794dbc1cf88a029)

```
require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'dry-monads', '1.3.5'
  gem 'rspec', '3.9.0'
end

require 'dry-monads'

class Service
  include Dry::Monads[:result, :do]

  def call
    yield fetch_data
  end

  private

  def fetch_data
    Success(:data)
  end
end

RSpec.describe Service do
  subject(:service) { Service.new }

  describe '#call' do
    it 'returns data' do
      expect(service.call).to eq(:data)
    end
  end

  describe '#fetch_data' do
    it 'raises NoMethodError' do
      expect { service.fetch_data }.to raise_error(NoMethodError)
    end
  end
end

RSpec::Core::Runner.run(['spec', '--format', 'doc'])

# $ ruby dry_monad_private_issue.rb
#
# Service
# #call
# returns data
# #fetch_data
# raises NoMethodError (FAILED - 1)
#
# Failures:
#
# 1) Service#fetch_data raises NoMethodError
# Failure/Error: expect { service.fetch_data }.to raise_error(NoMethodError)
# expected NoMethodError but nothing was raised
# # dry_monad_private_methods_issue.rb:36:in `block (3 levels) in <main>'
# # dry_monad_private_methods_issue.rb:41:in `<main>'
#
# Finished in 0.01185 seconds (files took 0.13012 seconds to load)
# 2 examples, 1 failure
#
# Failed examples:
#
# rspec dry_monad_private_methods_issue.rb:35 # Service#fetch_data raises NoMethodError
```
