Skip to content

Instantly share code, notes, and snippets.

@dysbulic
Created September 20, 2014 01:26
Show Gist options
  • Save dysbulic/d53c01187da7e051edda to your computer and use it in GitHub Desktop.
Save dysbulic/d53c01187da7e051edda to your computer and use it in GitHub Desktop.
Theoretical mechanism for selecting values
- { yes: :✔, no: :– }.try( product.sold_by_amazon? ? :first : :last ) do |sold?, text|
%td.sba{ class: sold? }= text
@dysbulic
Copy link
Author

- Proc.new{ |p| yield ([{ yes: :✔ }, { no: :– }].try( :[], product.sold_by_amazon? ? 0 : 1 )) }.call do |sold, text|
  %td.sba{ class: sold }= text

Works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment