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

Refactor application of type decorators into an object #15759

Merged
merged 1 commit into from
Jun 16, 2014

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Jun 16, 2014

No description provided.

class TypeDecorator
delegate :clear, to: :@decorations

def initialize(decorations = Hash.new({}))
Copy link
Member

Choose a reason for hiding this comment

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

Is not { } sufficient?

Copy link
Member

Choose a reason for hiding this comment

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

Also since it is always a empty hash should not we remove the argument?

Copy link
Member

Choose a reason for hiding this comment

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

Opps, just saw we create a new object on merge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It gets called with an argument on line 39. Line 37 should return an empty hash if the key is not present. (Both will go away soon)

Copy link
Member

Choose a reason for hiding this comment

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

Right. I forget the argument of Hash.new is the default value.

rafaelfranca added a commit that referenced this pull request Jun 16, 2014
Refactor application of type decorators into an object
@rafaelfranca rafaelfranca merged commit 88714de into rails:master Jun 16, 2014
@sgrif sgrif deleted the sg-extract-type-decorator branch June 16, 2014 21:11
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

2 participants