Class: Gnomika::Quote

Inherits:
Object
  • Object
show all
Defined in:
lib/gnomikologikon/quote.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, author) ⇒ Quote

Returns a new instance of Quote.



5
6
7
8
# File 'lib/gnomikologikon/quote.rb', line 5

def initialize(content, author)
  @content = content
  @author = author
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



3
4
5
# File 'lib/gnomikologikon/quote.rb', line 3

def author
  @author
end

#contentObject (readonly)

Returns the value of attribute content.



3
4
5
# File 'lib/gnomikologikon/quote.rb', line 3

def content
  @content
end

Instance Method Details

#to_sObject



10
11
12
13
14
# File 'lib/gnomikologikon/quote.rb', line 10

def to_s
  str = "#{@content}"
  str << "\n  - #{@author}" unless @author.strip.empty?
  str
end