Skip to content

Conversation

@roryokane
Copy link

Prompted by your statement

If this was production code, we should remember to implement #respond_to? as well.

at codon.com – Refactoring Ruby with Monads.

I implemented #respond_to? by implementing #respond_to_missing?, as recommended by thoughtbot – Always Define respond_to_missing? When Overriding method_missing, so that #method also works. This requires Ruby 1.9 and later.

Prompted by the statement “if this was production code, we should remember to implement `#respond_to?` as well” at http://codon.com/refactoring-ruby-with-monads.

I implemented `respond_to?` by implementing `respond_to_missing?`, as recommended by http://robots.thoughtbot.com/always-define-respond-to-missing-when-overriding, so that `method` also works. This requires Ruby 1.9 and later.
@tomstuart
Copy link
Owner

Sorry, I had notifications turned off and didn’t notice this PR.

Yours arrived first, but there’s some overlap with #5. I’d ideally like to merge an implementation that is a) correct and b) covered by tests. WDYT?

@sclinede
Copy link
Contributor

@roryokane this PR is stale... Will you add tests for your fix as @tomstuart mentioned?

sclinede added a commit to sclinede/monads that referenced this pull request Feb 20, 2016
Resolves tomstuart#2, as previous had no
tests.

See details in tomstuart#2 PR, breifly:
Prompted by @tomstuart statement: "If this was production code, we should remember to implement #respond_to? as well."
sclinede added a commit to sclinede/monads that referenced this pull request Feb 20, 2016
Resolves tomstuart#2, as previous had no
tests.

See details in tomstuart#2 PR, breifly:
Prompted by @tomstuart statement: "If this was production code, we should remember to implement #respond_to? as well."
sclinede added a commit to sclinede/monads that referenced this pull request Feb 20, 2016
Resolves tomstuart#2, as previous had no
tests.

See details in tomstuart#2 PR, breifly:
Prompted by @tomstuart statement: "If this was production code, we should remember to implement #respond_to? as well."
sclinede added a commit to sclinede/monads that referenced this pull request Feb 20, 2016
Resolves tomstuart#2, as previous had no
tests.

See details in tomstuart#2 PR, breifly:
Prompted by @tomstuart statement: "If this was production code, we should remember to implement #respond_to? as well."
sclinede added a commit to sclinede/monads that referenced this pull request Feb 20, 2016
Resolves tomstuart#2, as previous had no
tests.

See details in tomstuart#2 PR, breifly:
Prompted by @tomstuart statement: "If this was production code, we should remember to implement #respond_to? as well."
sclinede added a commit to sclinede/monads that referenced this pull request Feb 20, 2016
Resolves tomstuart#2, as previous had no
tests.

See details in tomstuart#2 PR, breifly:
Prompted by @tomstuart statement: "If this was production code, we should remember to implement #respond_to? as well."
sclinede added a commit to sclinede/monads that referenced this pull request Feb 20, 2016
Resolves tomstuart#2, as previous had no
tests.

See details in tomstuart#2 PR, breifly:
Prompted by @tomstuart statement: "If this was production code, we should remember to implement #respond_to? as well."
@tomstuart
Copy link
Owner

This change has now been incorporated into #10, so I’m closing it.

@tomstuart tomstuart closed this Feb 20, 2016
sclinede added a commit to sclinede/monads that referenced this pull request Feb 20, 2016
Resolves tomstuart#2, as previous had no tests.

See details in tomstuart#2 PR, breifly:
Prompted by @tomstuart statement: "If this was production code, we should remember to implement #respond_to? as well."
sclinede added a commit to sclinede/monads that referenced this pull request Feb 20, 2016
Resolves tomstuart#2, as previous had no tests.

See details in tomstuart#2 PR, breifly:
Prompted by @tomstuart statement: "If this was production code, we should remember to implement #respond_to? as well."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants