Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/monads/monad.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def method_missing(*args, &block)
end
end

def respond_to_missing?(method_name, include_all = false)
value.respond_to? method_name, include_all
end

private

def ensure_monadic_result(&block)
Expand Down
4 changes: 4 additions & 0 deletions spec/monads/optional_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ module Monads
it 'returns the message’s result wrapped in an Optional' do
expect(optional.challenge.value).to eq response
end

it 'correctly indicated whether a value can respond to a message' do
expect(optional).to respond_to :challenge
end
end
end
end