Class: TallyGem::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/tallygem/posts/post.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, number, author, text) ⇒ Post

Returns a new instance of Post.



6
7
8
9
10
11
12
# File 'lib/tallygem/posts/post.rb', line 6

def initialize(id, number, author, text)
  @id = id
  @number = number
  @author = author
  @text = text
  @votes = TallyGem::PostParser.instance.parse(text).to_a
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



5
6
7
# File 'lib/tallygem/posts/post.rb', line 5

def author
  @author
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/tallygem/posts/post.rb', line 5

def id
  @id
end

#numberObject

Returns the value of attribute number.



5
6
7
# File 'lib/tallygem/posts/post.rb', line 5

def number
  @number
end

#textObject

Returns the value of attribute text.



5
6
7
# File 'lib/tallygem/posts/post.rb', line 5

def text
  @text
end

#votesObject

Returns the value of attribute votes.



5
6
7
# File 'lib/tallygem/posts/post.rb', line 5

def votes
  @votes
end