Skip to content

Instantly share code, notes, and snippets.

@imajes
Created August 6, 2014 05:32
Show Gist options
  • Save imajes/12cdfe37b25628e82a28 to your computer and use it in GitHub Desktop.
Save imajes/12cdfe37b25628e82a28 to your computer and use it in GitHub Desktop.
main » DESIRED_CLASS
/price|product-price/i
main » node.attributes.values.map(&:to_s).first =~ DESIRED_CLASS
0
main » node.attributes.values.map(&:to_s).first =~ /price/
0
main » node.attributes.values.map(&:to_s).first == /price/
false
main » node.attributes.values.map(&:to_s).first == "price"
true
main » node.attributes.values.map(&:to_s).first
"price"
main » node.attributes.values.map(&:to_s).first.match(DESIRED_CLASS)
#<MatchData "price">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment