Class: StandupMD::Title

Inherits:
Object
  • Object
show all
Defined in:
lib/standup_md/title.rb

Overview

The title for a standup entry.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date) ⇒ Title

Constructs an instance of StandupMD::Title.

Parameters:

  • date (Date)

Raises:

  • (ArgumentError)


19
20
21
22
23
# File 'lib/standup_md/title.rb', line 19

def initialize(date)
  raise ArgumentError, "Must be a Date object" unless date.is_a?(Date)

  @date = date
end

Instance Attribute Details

#dateDate (readonly)

The entry date.

Returns:

  • (Date)


13
14
15
# File 'lib/standup_md/title.rb', line 13

def date
  @date
end

Instance Method Details

#to_markdownString

The title rendered as markdown.

Returns:

  • (String)


37
38
39
# File 'lib/standup_md/title.rb', line 37

def to_markdown
  "#" * StandupMD.config.file.header_depth + " " + to_s
end

#to_sString

The configured title text.

Returns:

  • (String)


29
30
31
# File 'lib/standup_md/title.rb', line 29

def to_s
  date.strftime(StandupMD.config.file.header_date_format)
end