class StandupMD::Entry
Class for handling single entries. Includes the comparable module, and compares by date.
Constants
- SECTION_TYPES
-
Sectionidentifiers supported by each standup entry.@return [Array<Symbol>]
Attributes
The date of the entry.
@param [Date] date
@return [Date]
Public Class Methods
Source
# File lib/standup_md/entry.rb, line 22 def self.config StandupMD.config.entry end
Access to the classβs configuration.
@return [StandupMD::Config::Entry]
Source
# File lib/standup_md/entry.rb, line 51 def self.create( config: StandupMD.config.entry, date: Date.today, current: nil, previous: nil, impediments: nil, notes: nil ) new( date, current || config.current, previous || config.previous, impediments || config.impediments, notes || config.notes ).tap { |entry| yield entry if block_given? } end
Creates a generic entry. Default values can be set via configuration. Yields the entry if a block is passed so you can change values.
@param [StandupMD::Config::Entry] config
@param [Date] date
@param [Array, nil] current
@param [Array, nil] previous
@param [Array, nil] impediments
@param [Array, nil] notes
@return [StandupMD::Entry]
Source
# File lib/standup_md/entry.rb, line 80 def initialize(date, current, previous, impediments, notes = []) raise unless date.is_a?(Date) @date = date @sections = {} self.current = current self.previous = previous self.impediments = impediments self.notes = notes end
Constructs instance of StandupMD::Entry.
@param [Date] date
@param [Array] current
@param [Array] previous
@param [Array] impediments
@param [Array] notes
Public Instance Methods
Source
# File lib/standup_md/entry.rb, line 125 def <=>(other) date <=> other.date end
Sorting method for Comparable. Entries are compared by date.
Source
# File lib/standup_md/entry.rb, line 119 def section(type) @sections[type.to_sym] ||= Section.new(type) end
Find a section by type.
@param [Symbol, String] type
@return [StandupMD::Section]
Source
# File lib/standup_md/entry.rb, line 109 def sections SECTION_TYPES.map { |type| section(type) } end
Sections for this entry.
@return [Array<StandupMD::Section>]