Class: Quotify::Quote
- Inherits:
-
Object
- Object
- Quotify::Quote
- Defined in:
- lib/quotify/quote.rb
Overview
This class represents a quote object
Instance Method Summary collapse
-
#author ⇒ #to_s
Returns the author.
-
#initialize(quote: nil, author: nil) ⇒ Quote
constructor
Generates a quote.
-
#quote ⇒ #to_s
Returns the quote.
-
#to_hash ⇒ Hash
(also: #to_h)
Returns the quote and author in a hash.
-
#to_json ⇒ String
Returns the quote and author in a JSON structured String.
-
#to_s(spacer: Quotify.config[:default_spacer]) ⇒ Object
Returns the quote and author in a string format.
-
#to_str(spacer: Quotify.config[:default_spacer]) ⇒ Object
Returns the quote and author in a string format.
Constructor Details
Instance Method Details
#quote ⇒ #to_s
Returns the quote
52 53 54 |
# File 'lib/quotify/quote.rb', line 52 def quote @quote end |
#to_hash ⇒ Hash Also known as: to_h
Returns the quote and author in a hash
34 35 36 |
# File 'lib/quotify/quote.rb', line 34 def to_hash { quote: @quote, author: @author } end |
#to_json ⇒ String
Returns the quote and author in a JSON structured String
40 41 42 |
# File 'lib/quotify/quote.rb', line 40 def to_json to_hash.to_json end |