Skip to content

Conversation

@dissolve
Copy link
Collaborator

@dissolve dissolve commented May 11, 2017

hmm thought i had privileges to review, it seems not.

Copy link
Contributor

@veganstraightedge veganstraightedge left a comment

Choose a reason for hiding this comment

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

I left the same comment in a few places, but it can be applied everywhere. I think this is a good time to move to almost/all named parameters since it's already a big breaking change release.

Also, I don't love the test suite requiring npm. I understand why you did it. It's pragmatic. But I'd like to see this get moved over to a ruby/rake workflow in the future.

when node.is_a?(Nokogiri::XML::Element) then [parse_for_microformats(node, parsing_children)]
end
end
def parse(element, base=nil, element_type=nil, fmt_classes=[], backcompat=false)
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 you should use named parameters here.

def parse(html)
Parser.new.parse(html)
def parse(html, base: nil)
Parser.new.parse(html, base)
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 Parser.new.parse() should use a named parameter for base.

end

def parse(html, headers={})
def parse(html, base= nil, headers={})
Copy link
Contributor

Choose a reason for hiding this comment

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

More that should be named parameters.

class Collection
def initialize(hash)
@hash = hash
end
Copy link
Contributor

Choose a reason for hiding this comment

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

These methods should have vertical whitespace between them.

end
def to_hash
@hash
end
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 it'd be good to alias to_h to to_hash too.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine, but for future resilience and DRYer code, you should use alias_method.

alias_method :baz, :foo

Ben Roberts added 2 commits May 12, 2017 08:40
missed a few tabbing issues
more consistant spacing
changed all functions to be named parameters after the first
 this should have been changed when that change was first made, but
 this now adds a min version for ruby of 2.0
 when named params first introduced
@veganstraightedge veganstraightedge merged commit f3b3f6e into master May 12, 2017
@veganstraightedge veganstraightedge deleted the 3-rebase branch May 12, 2017 21:37
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