lib/standup_md/cli/helpers.rb in standup_md-0.3.13 vs lib/standup_md/cli/helpers.rb in standup_md-0.3.14
- old
+ new
@@ -10,14 +10,12 @@
#
# @param [StandupMD::Entry] entry
#
# @return [nil]
def print(entry)
- if entry.nil?
- puts "No record found for #{config.cli.date}"
- return
- end
+ return puts "No record found for #{config.cli.date}" if entry.nil?
+
puts header(entry)
config.file.sub_header_order.each do |header_type|
tasks = entry.public_send(header_type)
next if !tasks || tasks.empty?
@@ -140,11 +138,10 @@
# The "previous" entries.
#
# @return [Array]
def previous_entry(file)
return config.entry.previous_entry unless config.cli.auto_fill_previous
-
return prev_entry(prev_file.load.entries) if file.new? && prev_file
prev_entry(file.entries)
end
@@ -153,12 +150,10 @@
#
# @param [StandupMD::EntryList] entries
#
# @return [StandupMD::Entry]
def prev_entry(entries)
- return [] if entries.empty?
-
- entries.last.current
+ entries.empty? ? [] : entries.last.current
end
##
# The previous month's file.
#