Skip to content

Instantly share code, notes, and snippets.

@mholubowski
Created May 1, 2014 03:28
Show Gist options
  • Save mholubowski/0c428ca2edfc681021ac to your computer and use it in GitHub Desktop.
Save mholubowski/0c428ca2edfc681021ac to your computer and use it in GitHub Desktop.
Ruby Problem
# The variable raw_name_data is set to the multiline
# string surrounded by 'datablock'
raw_name_data = <<-datablock
Name: Mike bullshit bullshit bullshit bullshit bullshit
Age: 13 bullshit bullshit bullshit bullshit bullshit
bullshit bullshit bullshit bullshit bullshit bullshit
bullshit bullshit bullshit bullshit bullshit bullshit
bullshit bullshit bullshit bullshit bullshit bullshit
bullshit bullshit bullshit Name: Nick Age: 22 bullshit
bullshit bullshit bullshit bullshit bullshit bullshit
bullshit bullshit bullshit bullshit bullshit bullshit
Name: Jack Age: 20 bullshit bullshit bullshit
datablock
# level 1
# combined age should evaluate to 35
#
# do lots of stuff here
#
#
# print combined_age
# Level 2
# Make this work:
# get_combined_ages(raw_data, ['Mike', 'Nick'])
# => 35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment