txt_timesheet 1.1.12 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40fadf717728a9dd4160dc341e98ff5dd1e9b0891cd1b0ba410e9c9398ea40e3
4
- data.tar.gz: 845f042440ef0e81b7f9395bde0f63fe7af5e3797d223307cef234ea89c6d3f6
3
+ metadata.gz: '08470fe381a48aedf40c08e78d0f2885516bab22f586e3aeb121cd85f3431dae'
4
+ data.tar.gz: 6af41285c78b9c1deb410a767f894521549613ec0f1f17d4e3ca517f76da34d5
5
5
  SHA512:
6
- metadata.gz: d43a914967e0eaf5d02dc14d5d8fdc2fe6b771d661e3ad7d9e7fbb3c94fd3916dea488cad918fb0dc2b18adfa5f853d64afa3be92601717d7197681b751b2de2
7
- data.tar.gz: 4b5c43290c4e3e428690282fa9e4fa9e216c7431ca8494b987635b2a08d0513004a8f40c9a25ba7daf01c03ec81121787c657b66aea3dedfd266a3309f82f00c
6
+ metadata.gz: 3bb8f3afc6c4a446bf42afb09e9ae326b887838e33c47cbc59b0042667ec3d70b6a0982fb5a302081d1743e56276304a13254e1c1a985a8c0341af187adc1b14
7
+ data.tar.gz: b7b38b26ec472654b6476df591fbde2fee4148e4740f48fc3a8360b47c7e013ccd46e13af5cbf06630f9beb0b5d59a4b3a4fa0da5bfcb11032a7e1dda084798f
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TxtTimesheet
4
- VERSION = '1.1.12'
4
+ VERSION = '1.3.0'
5
5
  end
data/lib/txt_timesheet.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'time'
4
- # Treat past files as a parameter and calculate total hours worked
4
+ # Treat passed files as parameters and calculates total hours worked
5
+
5
6
  class TxtTimesheet
6
7
  def initialize
7
8
  @can_parse = false
@@ -32,6 +33,10 @@ class TxtTimesheet
32
33
  line = content_file.gets.chomp
33
34
  set_can_parse(line)
34
35
 
36
+ if line.match(/^description:/)
37
+ phrase = line.split(':')[1]
38
+ end
39
+
35
40
  next unless can_parse?
36
41
 
37
42
  next unless time_regex.match(line)
@@ -48,12 +53,11 @@ class TxtTimesheet
48
53
  ###
49
54
  total_sec = sum_time
50
55
 
51
- # phrase = 'xixixococo'
52
56
 
53
57
  {
54
58
  file_name: filename,
55
- file_time: total_sec
56
- # phrase: phrase
59
+ file_time: total_sec,
60
+ phrase: phrase
57
61
  }
58
62
  end
59
63
 
@@ -67,9 +71,9 @@ class TxtTimesheet
67
71
  file_name = result[:file_name]
68
72
  time_file = result[:file_time]
69
73
  total_time += time_file
70
- # phrase = result[:phrase]
74
+ phrase = result[:phrase]
71
75
  time_file = Time.at(time_file).utc
72
- output << "#{file_name}: #{time_file.strftime('%H:%M')} hours \n"
76
+ output << "#{file_name}: #{time_file.strftime('%H:%M')} hours -#{phrase}\n"
73
77
 
74
78
  # total_time = result[:file_time]
75
79
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Elvis Serrão']
9
9
  spec.email = ['elvis.serrao1@gmail.com']
10
10
 
11
- spec.summary = 'Calculate Timesheet.'
12
- spec.description = 'Receive n files as command line parameters, parse these files and than, calculates how many hours has been worked .'
11
+ spec.summary = 'Calculates Timesheet.'
12
+ spec.description = 'Receive n files as command line parameters, parse these files and then, calculates how many hours has been worked.'
13
13
  spec.homepage = 'https://elvisserrao.github.io/'
14
14
  spec.license = 'MIT'
15
15
  spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: txt_timesheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.12
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elvis Serrão
@@ -10,8 +10,8 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-12-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Receive n files as command line parameters, parse these files and than,
14
- calculates how many hours has been worked .
13
+ description: Receive n files as command line parameters, parse these files and then,
14
+ calculates how many hours has been worked.
15
15
  email:
16
16
  - elvis.serrao1@gmail.com
17
17
  executables:
@@ -59,5 +59,5 @@ requirements: []
59
59
  rubygems_version: 3.0.6
60
60
  signing_key:
61
61
  specification_version: 4
62
- summary: Calculate Timesheet.
62
+ summary: Calculates Timesheet.
63
63
  test_files: []