Skip to content

Instantly share code, notes, and snippets.

@ashbb
Created November 16, 2010 14:39
Show Gist options
  • Save ashbb/701880 to your computer and use it in GitHub Desktop.
Save ashbb/701880 to your computer and use it in GitHub Desktop.
require '../lib/green_shoes'
DATA = %w{ place plan plant plot face race rails ruby train trouble double }
MSG = "Enter a search."
Shoes.app title: "Search sample", width: 300, height: 400 do
def search input
input.empty? ? [] : DATA.select{|w| w.include? input}
end
edit_line width: 300 do |el|
results = search el.text
@results.clear do
results.empty? ? para(MSG) :
results.each do |word|
stack do
background forestgreen, curve: 6
para ' ', fg(strong(word), white)
end
end
end
end
@results = flow{para MSG}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment