txt_timesheet 1.1.4 → 1.1.6

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: 23cbed616dd6723ce4a9f1e491c03fb42790b2a94a782280fd8a0457b3d7a479
4
- data.tar.gz: 6745a0a0cc99c7eaf0b178dfd046e2d002276abc64d27d3568837996bd2b0537
3
+ metadata.gz: 89d4fe4d699dcd22d32ed9f7cb817ce4e61f4f3122777e3898ec62389bb041a0
4
+ data.tar.gz: 0b7930337240323c931045e5bedd6d5430246f0eeb89acfd5cb3c19acf78e962
5
5
  SHA512:
6
- metadata.gz: e02167b7c6d880e9eaf6b90f47233427a76e467697fdab0cf0ba6147a36509752806024643bb38d3370b079f9c050b31029de5d744ad9f0aaa0af34c547b1111
7
- data.tar.gz: 96d82e5c55532ae8d78a073e7085a3a64dd321bb0cb4ad77b11dc622cdfd1a0adeda642cf399afbc24ee0e0a6a12813407fad7c5d35a28462474e426ebe996c2
6
+ metadata.gz: 17b440a82bd1eb7f699f31d59ebed2603b9a3aafe06a174b492b1e238170d850f94e664aa33047dac0be483137f80383cce1bb593f2db65f5852ea86b8030383
7
+ data.tar.gz: 1cd6cf3426c68c9a0a7ffe34cc1b339962b49bd5abfdde0ca45908b86e7c67d2ac4c1bb9d5053ba4f3de42000aa96ed9ff63f284d40301870fa766a67a0d12f3
data/bin/timesheet CHANGED
@@ -5,5 +5,5 @@ $LOAD_PATH.unshift("#{__dir__}/../lib")
5
5
 
6
6
  require 'txt_timesheet'
7
7
 
8
- initialize = TxtTimesheet.new
9
- initialize.run
8
+ cli = TxtTimesheet.new
9
+ cli.run
@@ -1,3 +1,3 @@
1
1
  module TxtTimesheet
2
- VERSION = "0.1.0"
2
+ VERSION = "1.1.6"
3
3
  end
data/lib/txt_timesheet.rb CHANGED
@@ -2,22 +2,17 @@
2
2
 
3
3
  # Treat past files as a parameter and calculate total hours worked
4
4
  class TxtTimesheet
5
- def convert(par)
5
+
6
+ def convert(time_in_minutes)
6
7
  ### Convert working time to hh:mm format
7
- hours = par / 60
8
- hours = hours.to_i
9
- minutes = par - hours * 60
8
+ hours = time_in_minutes / 60
9
+ minutes = time_in_minutes - hours * 60
10
10
  ## Add 0 to keep hh: mm format
11
- hours = "0#{hours}" if hours < 10
12
- minutes = "0#{minutes}" if minutes < 10
13
-
14
- time = "#{hours}:#{minutes}"
15
-
16
- time
11
+ "%02d:%02d" % [hours, minutes]
17
12
  end
18
-
13
+
19
14
  def run
20
- time_regex = /(?<hours>\d{2})\:(?<minutes>\d{2})/
15
+ time_regex = /(?<hours>\d+)\:(?<minutes>\d+)/
21
16
  total_time = 0
22
17
 
23
18
  puts 'REPORT:'
@@ -68,7 +63,7 @@ class TxtTimesheet
68
63
  end
69
64
  ###
70
65
 
71
- ### Calcula o tempo trabalhado em minutos
66
+ ### Calculates worked time in minutes
72
67
  index = 0
73
68
  while index < input_count
74
69
  sum_time = time_in_min[index + 1] - time_in_min[index] + sum_time
@@ -2,7 +2,7 @@ require_relative 'lib/txt_timesheet/version'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "txt_timesheet"
5
- spec.version = "1.1.4"
5
+ spec.version = TxtTimesheet::VERSION
6
6
  spec.authors = ["Elvis Serrão"]
7
7
  spec.email = ["elvis.serrao1@gmail.com"]
8
8
 
@@ -12,7 +12,11 @@ Gem::Specification.new do |spec|
12
12
  spec.license = "MIT"
13
13
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
14
 
15
- spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata = {
16
+ 'homepage_uri' => 'https://elvisserrao.github.io/',
17
+ 'source_code_uri' => 'https://github.com/elvisserrao/txt-timesheet'
18
+ }
19
+
16
20
 
17
21
  # Specify which files should be added to the gem when it is released.
18
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: txt_timesheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elvis Serrão
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-16 00:00:00.000000000 Z
11
+ date: 2019-10-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Receive n files as command line parameters, parse these files and than,
14
14
  calculates how many hours has been worked .
@@ -39,6 +39,7 @@ licenses:
39
39
  - MIT
40
40
  metadata:
41
41
  homepage_uri: https://elvisserrao.github.io/
42
+ source_code_uri: https://github.com/elvisserrao/txt-timesheet
42
43
  post_install_message:
43
44
  rdoc_options: []
44
45
  require_paths: