Created
June 10, 2015 17:22
-
-
Save ciprianna/5e181d863b9fa2a7289b to your computer and use it in GitHub Desktop.
Mini Projects with Active Support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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