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]
Iimpediments 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 entry = new( Date.today, config.current, config.previous, config.impediments, config.notes ) yield config if block_given? entry 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 81 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 94 def <=>(other) date <=> other.date end
Entry
as a hash .
@return [Hash]
# File lib/standup_md/entry.rb, line 102 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 117 def to_json to_h.to_json end