Skip to content

Instantly share code, notes, and snippets.

@nuke99
Created May 30, 2012 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuke99/74840aae2b3a52865850 to your computer and use it in GitHub Desktop.
Save nuke99/74840aae2b3a52865850 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
class Storage
def initialize
@info = {'photoshop'=>'this is used for photos hoped','photomas'=>'this is a photo editing tool','dreamviwer'=>'used for web design'}
end
def output
@info.each do |k,v|
puts "#{k} #{v} "
end
end
def search(lis)
# k =~ query or v =~ query
@info.each do |k,v|
if (k =~ lis or v =~ lis)
puts "#{v} #{k}"
end
end
end
end
c = Storage.new()
c.search("photo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment