Skip to content

Conversation

@maximgladkov
Copy link

No description provided.

Copy link
Collaborator

@marcandre marcandre left a comment

Choose a reason for hiding this comment

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

Fabulous stuff 🎆

The result is really nice.

At first sight, I just have a few minor things.

We don't have a rubocop check, but I notice that your editor isn't configured to insure there's a <cr> at the end of files. Ideally that would be fixed too.

INTERIM_TH_TAG_REGEX = %r{(?<=\<|\<\/)#{Regexp.escape(INTERIM_TH_TAG)}}

DEFAULT_COMPONENTS = {
"button" => Inky::Components::Button,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might as well be consistent and use ::Inky...

self.components = DEFAULT_COMPONENTS
.merge(options[:components] || ::Inky.configuration.components)
.transform_values { |component_class| component_class.new(self) }
.with_indifferent_access
Copy link
Collaborator

Choose a reason for hiding this comment

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

Best not use with_indifferent_access which is Rails-only (and controversial)

def initialize(options = {})
self.components = DEFAULT_COMPONENTS
.merge(options[:components] || ::Inky.configuration.components)
.transform_values { |component_class| component_class.new(self) }
Copy link
Collaborator

Choose a reason for hiding this comment

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

transform_values is Ruby 2.4+ only; we support older rubies (I think). Would be easy to require 'backports/2.4.0/hash/transform_values' or change the code.

@inky = inky
end

def _pass_through_attributes(elem)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure why these methods started with _ (simili-private?) but if we are to move them we probably should use the standard conventions and remove the leading _. You can make them protected if you like, but I don't feel that would be necessary.

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