Module: UpliftingQuote
- Extended by:
- UpliftingQuote
- Included in:
- UpliftingQuote
- Defined in:
- lib/uplifting_quote.rb,
lib/uplifting_quote/version.rb
Constant Summary collapse
- VERSION =
"0.2.0"
Instance Method Summary collapse
Instance Method Details
#add(this, that) ⇒ Object
8 9 10 11 12 13 14 |
# 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 ⇒ Object
24 25 26 27 28 29 30 |
# 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) ⇒ Object
16 17 18 19 20 21 22 |
# 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 |