class StandupMD::Entry
Class for handling single entries. Includes the comparable module, and compares by date.
Attributes
The tasks for today.
@return [Array]
The date of the entry.
@param [Date] date
@return [Date]
Impediments for this entry.
@return [Array]
Nnotes to add to this entry.
@return [Array]
The tasks from the previous day.
@return [Array]
Public Class Methods
Access to the class's configuration.
@return [StandupMD::Config::Entry]
# File lib/standup_md/entry.rb, line 16 def self.config @config ||= StandupMD.config.entry 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.
@return [StandupMD::Entry]
# File lib/standup_md/entry.rb, line 57 def self.create new( Date.today, config.current, config.previous, config.impediments, config.notes ).tap { |entry| yield entry if block_given? } end
Constructs instance of StandupMD::Entry
.
@param [Date] date
@param [Array] current
@param [Array] previous
@param [Array] impediments
@param [Array] notes
# File lib/standup_md/entry.rb, line 79 def initialize(date, current, previous, impediments, notes = []) raise unless date.is_a?(Date) @config = self.class.config @date = date @current = current @previous = previous @impediments = impediments @notes = notes end
Public Instance Methods
Sorting method for Comparable. Entries are compared by date.
# File lib/standup_md/entry.rb, line 92 def <=>(other) date <=> other.date end
Entry
as a hash .
@return [Hash]
# File lib/standup_md/entry.rb, line 100 def to_h { date => { 'current' => current, 'previous' => previous, 'impediments' => impediments, 'notes' => notes } } end
Entry
as a json object.
@return [String]
# File lib/standup_md/entry.rb, line 115 def to_json to_h.to_json end