Skip to content

Instantly share code, notes, and snippets.

@ciprianna
Created June 10, 2015 17:22
Show Gist options
  • Save ciprianna/5e181d863b9fa2a7289b to your computer and use it in GitHub Desktop.
Save ciprianna/5e181d863b9fa2a7289b to your computer and use it in GitHub Desktop.
Mini Projects with Active Support
require "active_support"
require "active_support/core_ext/String/filters.rb"
puts "What paragraph would you like to truncate?"
paragraph = gets.chomp
puts "How many characters would you like to have?"
character_length = gets.to_i
puts paragraph.truncate(character_length)
require "active_support"
require "active_support/core_ext/numeric/conversions.rb"
puts "What's your phone number?"
number_input = gets.to_i
puts "That's #{number_input.to_s(:phone, area_code: true)}, right?"
# Word Connector
require "active_support/core_ext/array/conversions"
puts "Give me a list of words (comma separated):"
list = gets.chomp
list_array = list.split(', ')
puts list_array.to_sentence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment