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

u3d/available: allow to match using regular expression #216

Merged
merged 1 commit into from
Jan 8, 2018

Conversation

lacostej
Copy link
Member

@lacostej lacostej commented Jan 7, 2018

requires #215 to be merged. I will rebase when ready.

module Extractable
refine Hash do
def extract(*keys)
select { |k, _v| keys.include?(k) }
Copy link
Member

Choose a reason for hiding this comment

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

def extract(*args)
  self.keys & args
end

This may be cleaner?

Copy link
Member Author

Choose a reason for hiding this comment

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

does that work?

Copy link
Member

@niezbop niezbop Jan 8, 2018

Choose a reason for hiding this comment

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

Oops, maybe not. This should though:

def extract(*args)
  keys & args
end

Copy link
Member Author

Choose a reason for hiding this comment

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

image

Copy link
Member

Choose a reason for hiding this comment

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

Misunderstood the intent. Sorry

@lacostej lacostej force-pushed the available_version_matcher branch from 8eada60 to cc677aa Compare January 8, 2018 09:35
@lacostej lacostej merged commit 48df3ba into DragonBox:master Jan 8, 2018
@lacostej lacostej deleted the available_version_matcher branch January 8, 2018 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants