Class: DevTo::Post

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePost

Returns a new instance of Post.



6
7
8
# File 'lib/dev_to/post.rb', line 6

def initialize
  self.class.all << self
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



2
3
4
# File 'lib/dev_to/post.rb', line 2

def author
  @author
end

#commentsObject

Returns the value of attribute comments.



2
3
4
# File 'lib/dev_to/post.rb', line 2

def comments
  @comments
end

#contentObject

Returns the value of attribute content.



2
3
4
# File 'lib/dev_to/post.rb', line 2

def content
  @content
end

#dateObject

Returns the value of attribute date.



2
3
4
# File 'lib/dev_to/post.rb', line 2

def date
  @date
end

#likesObject

Returns the value of attribute likes.



2
3
4
# File 'lib/dev_to/post.rb', line 2

def likes
  @likes
end

#tagsObject

Returns the value of attribute tags.



2
3
4
# File 'lib/dev_to/post.rb', line 2

def tags
  @tags
end

#titleObject

Returns the value of attribute title.



2
3
4
# File 'lib/dev_to/post.rb', line 2

def title
  @title
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/dev_to/post.rb', line 2

def url
  @url
end

Class Method Details

.allObject



14
15
16
# File 'lib/dev_to/post.rb', line 14

def self.all
  @@all
end

.find(id) ⇒ Object



10
11
12
# File 'lib/dev_to/post.rb', line 10

def self.find(id)
  self.all[id.to_i-1]
end