Skip to content

Instantly share code, notes, and snippets.

@kouky
Created November 18, 2009 00:55
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 kouky/237447 to your computer and use it in GitHub Desktop.
Save kouky/237447 to your computer and use it in GitHub Desktop.
require 'exemplor'
eg 'working with an array' do
names = %w{Michael Tim Myles}
Check(names)[names]
# Output for disambiguation is not pretty
# (I) working with an array:
# (i) names MichaelTimMyles:
# - Michael
# - Tim
# - Myles
end
eg 'working with a hash' do
person = {:name => 'Michael', :email => 'mkoukoullis@gmail.com', :mobile => 0413310401}
Check(person)[person]
# Output for disambiguation is not pretty
# (I) working with a hash:
# (i) person emailmkoukoullis@gmail.comnameMichaelmobile70095105:
# :email: mkoukoullis@gmail.com
# :name: Michael
# :mobile: 70095105
end
eg 'working with an array of hashes' do
people = [{:name => 'Michael', :email => 'mkoukoullis@gmail.com', :mobile => 0413310401},
{:name => 'Myles', :email => 'mylesbyrne@gmail.com', :mobile => 0404562452}]
Check(people)[people]
# Output for disambiguation is not pretty
# (I) working with an array of hashes:
# (i) people emailmkoukoullis@gmail.comnameMichaelmobile70095105emailmylesbyrne@gmail.comnameMylesmobile68347178:
# - :email: mkoukoullis@gmail.com
# :name: Michael
# :mobile: 70095105
# - :email: mylesbyrne@gmail.com
# :name: Myles
# :mobile: 68347178
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment