Skip to content

Conversation

@shuheiktgw
Copy link
Contributor

I cleaned up multi_to_json.rb in the following two ways.

  • Changed some unnecessarily public method private.
  • Removed unused self.reset_to_json! method

@shuheiktgw
Copy link
Contributor Author

shuheiktgw commented Apr 20, 2018

This PR will be meaningless if #177 is merged

@shishirmk
Copy link
Collaborator

@shuheiktgw I like #177 lets see what @bf4 says about the changes. They look good to me

_fast_to_json(object)
end

private
Copy link
Contributor

Choose a reason for hiding this comment

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

I think what you might mean here is to apply # @api private to the below methods, which I disagree with. It might make more sense to document intended usage, but I would say this is all a stable public API.

The private keyword has no effect on the interface.

In any case, the argument I can see for declaring it # @api private would be to say to anyone using the library not to rely on those methods being there, whether or not their public. (In Ruby, nothing's really private anyhow).


def self.reset_to_json!
undef :_fast_to_json if method_defined?(:_fast_to_json)
logger.debug { "Undefining #{receiver}._fast_to_json" }
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ It's not used in the normal lifecycle of the app and because there's no test in the suite, but I wouldn't say it serves no purpose. Especially if this module were made module_function and included.

I do have some tests I started writing in https://github.com/bf4/fast_multi_json but they didn't cover this specifically

@shuheiktgw
Copy link
Contributor Author

@bf4 Thank you so much for your comments! I should probably reconsider about this PR...

@shuheiktgw shuheiktgw closed this Apr 22, 2018
@shuheiktgw shuheiktgw deleted the clean_up_multi_to_json branch April 22, 2018 09:44
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