module UpliftingQuote
Constants
- VERSION
Public Instance Methods
add(this, that)
click to toggle source
# File lib/uplifting_quote.rb, line 8 def add(this, that) begin this + that rescue TypeError raise "#{this} and/or #{that} is not a number, try again..." end end
get_quote()
click to toggle source
# File lib/uplifting_quote.rb, line 24 def get_quote() url = 'http://quotes.rest/qod.json?category=inspire' uri = URI(url) response = Net::HTTP.get(uri) hash_response = JSON.parse(response) quote = hash_response["contents"]["quotes"][0]["quote"] end
reverse(value)
click to toggle source
# File lib/uplifting_quote.rb, line 16 def reverse(value) begin value.reverse rescue NoMethodError raise "#{value} is not a string, try again..." end end