fewald-worklog 0.3.15 → 0.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/lib/hash.rb +5 -5
  4. data/lib/printer.rb +9 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da159df72952acb0df4908e1e5ed04b5a43def0d9d8f351b19f407aa672d108b
4
- data.tar.gz: 7afc0a6cd0da2f10456203c27b1c48ce0b1117f428932c1fb1157b32baaeeced
3
+ metadata.gz: daf7ba6ce29841da81257ab2588d1a0a8c5e8d676ddc1e2e128193800c0c99bd
4
+ data.tar.gz: 6be278d7cee0950a81547ed66f4e3705fae8996295c6bf6fff4ad49e2301bc7c
5
5
  SHA512:
6
- metadata.gz: 47553eb33fd2b3dc6c2c664431f36d99ab395832c29a26e4d4a06a6482d9244ad7035cf956bbb91d3bcbc2ae17cb2f79863ce7b04cfc0316848662f31862cb18
7
- data.tar.gz: 5b1185d6bdd7fdef351ff7935a7d3b0512efa1027af2fc84972a682e06a8d03c0553127ebf8813a4067f2bdb9c4fc9f4bbce2aa66082da7ba29c17191f29a8f1
6
+ metadata.gz: 57dff043170f5d3bf474367a7589350d76d132140a3e3a97335d01547442401f9151b67ec21eaedf0d283f89a25184fe4e045e7c793f66043961cf41806a5379
7
+ data.tar.gz: 012ba10f1d2b98e429ccf0e8ac500022ccb10bb1b9ec75070679e91edade978539b724c855a88e339248718567e8faa89d6ac6f8adbbf008c393841672b561a9
data/.version CHANGED
@@ -1 +1 @@
1
- 0.3.15
1
+ 0.3.17
data/lib/hash.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hashify
4
+ # Convert the object's instance variables to a hash.
5
+ # @return [Hash] the hash representation of the object
4
6
  def to_hash
5
- hash = {}
6
- instance_variables.each do |var|
7
- value = instance_variable_get(var)
8
- hash[var.to_s.delete('@')] = value
7
+ instance_variables.each_with_object({}) do |var, hash|
8
+ key = var.to_s.delete('@').to_sym
9
+ hash[key] = instance_variable_get(var)
9
10
  end
10
- hash
11
11
  end
12
12
  end
13
13
 
data/lib/printer.rb CHANGED
@@ -29,7 +29,15 @@ class Printer
29
29
  daily_log.date = Date.strptime(daily_log.date, '%Y-%m-%d') unless daily_log.date.respond_to?(:strftime)
30
30
 
31
31
  date_string = daily_log.date.strftime('%a, %B %-d, %Y')
32
- puts "Work log for #{Rainbow(date_string).gold}" unless date_inline
32
+ preamble = "Work log for #{Rainbow(date_string).gold}"
33
+ puts preamble unless date_inline
34
+
35
+ # Print only if there are entries to show, especially when epics_only is true
36
+ entries_count = daily_log.entries.count do |entry|
37
+ (!epics_only || entry.epic?) && filter.compact.all? { |k, v| entry.send(k) == v }
38
+ end
39
+
40
+ puts Rainbow('-' * preamble.gsub(/\e\[[0-9;]*m/, '').length).gold if entries_count.positive?
33
41
 
34
42
  daily_log.entries.each do |entry|
35
43
  next if epics_only && !entry.epic?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fewald-worklog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.15
4
+ version: 0.3.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Friedrich Ewald