Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate canonical data methods from ExerciseCase #648

Merged
merged 10 commits into from
May 31, 2017

Conversation

Insti
Copy link
Contributor

@Insti Insti commented May 18, 2017

ExerciseCase should not be an OpenStruct and the canonical data should be kept separate from the methods of this class.

from Generator Improvements #485.

Supersedes #640 (Closed)
Depends on #650 (Closed/Merged)
Completes #622 (Closed) to a usable state.

@Insti Insti changed the title Separate canonical data methods from ExerciseCase [WIP] - Separate canonical data methods from ExerciseCase May 18, 2017
@Insti
Copy link
Contributor Author

Insti commented May 18, 2017

There are a lot of changes in ba6daa3 that are not directly related to separating the canonical data methods from ExerciseCase that I want to pull out of this PR.

Edit: Extracted in #650 and force-pushed this branch to build on top of that.

@Insti Insti force-pushed the Complete_PR_622_using_method_missing branch from c640dfd to 80aafb1 Compare May 18, 2017 18:09
@Insti Insti changed the title [WIP] - Separate canonical data methods from ExerciseCase Separate canonical data methods from ExerciseCase May 18, 2017
@Insti Insti force-pushed the Complete_PR_622_using_method_missing branch 4 times, most recently from 96eb2ce to 2cb75d8 Compare May 21, 2017 21:43
@Insti
Copy link
Contributor Author

Insti commented May 21, 2017

#650 has been merged, rebased to master and force-pushed this branch.

@Insti Insti force-pushed the Complete_PR_622_using_method_missing branch from 2cb75d8 to e08ebb2 Compare May 21, 2017 21:49
Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally like it, a couple of changes that can be made, but nothing really stopping it from coming in.

@@ -17,7 +17,7 @@ def beer_song_arguments
if property == 'verse'
number
else
"%s, %s" % [self["beginning"], self["end"]]
"%s, %s" % [self.beginning, self.end]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... beginning and ending would be a match here, and would avoid the 'stroop effect' caused by the standard use of begin and end in Ruby.

Something to consider. Not a required change for bringing this in though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These names come from the canonical data so we're constrained by what it provides.

@@ -19,7 +19,4 @@ def single_quote(string)
string.inspect.tr('"', "'")
end

def ignore_method_length
"# rubocop:disable MethodLength\n " if board.length > 8
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! This is gone!

@@ -3,45 +3,41 @@
module Generator
class ExerciseCaseTest < Minitest::Test
def test_name
assert_equal 'test_foo', ExerciseCase.new(description: 'foo').name
subject = ExerciseCase.new(canonical: OpenStruct.new('description' => 'foo'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change in style from symbol: key to 'string' => key here, while maintaining the style of symbol: key in the most of the rest of the file? (see line 34 as another deviation from the style)

Copy link
Contributor Author

@Insti Insti May 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair comment. Updated to use symbols.
(This was a left-over from the hash to OpenStruct conversion.)

@@ -16,7 +16,7 @@ def indent(size, lines)
end

def assertion
return error_assertion unless expected
return error_assertion if expected == false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return error_assertion unless expected

Or

return error_assertion if expected.false?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do the other cases address the assertions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is false? defined?

Neither of these will work.

expected comes from the canonical data and is either not present or an integer or false.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That answers that then. 👍 Thanks.

@kotp kotp merged commit e5ce38f into exercism:master May 31, 2017
@Insti Insti deleted the Complete_PR_622_using_method_missing branch May 31, 2017 09:31
@Insti Insti removed the ready label May 31, 2017
@Insti Insti mentioned this pull request May 31, 2017
@Insti Insti removed the ready label Jun 8, 2017
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.

None yet

3 participants