Class: TinyPress::Post

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, description, date, publish, body) ⇒ Post

Public: Create a new instance of Post.

title - A String that represents the Post’s title. description - A short String description of the Post. date - A Date object that indicates when this Post was written. publish - A Boolean value indicating if this post should be published body - A String representing the body of the post

Returns an instance of Post.



14
15
16
17
18
19
20
# File 'lib/tinypress/post.rb', line 14

def initialize( title, description, date, publish, body )
    @title          = title
    @description    = description
    @date           = date
    @publish        = publish
    @body           = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/tinypress/post.rb', line 3

def body
  @body
end

#dateObject (readonly)

Returns the value of attribute date.



3
4
5
# File 'lib/tinypress/post.rb', line 3

def date
  @date
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/tinypress/post.rb', line 3

def description
  @description
end

#publishObject (readonly)

Returns the value of attribute publish.



3
4
5
# File 'lib/tinypress/post.rb', line 3

def publish
  @publish
end

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/tinypress/post.rb', line 3

def title
  @title
end

Instance Method Details

#publish?Boolean

Public: Indicates if this Post should be published.

Examples

print post if post.publish?

Returns true if this Post should be published, otherwise returns false.

Returns:

  • (Boolean)


29
30
31
# File 'lib/tinypress/post.rb', line 29

def publish?
    @publish
end