rubyswizz 1.2.1
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.
- checksums.yaml +7 -0
- data/bin/ruby_swizz +4 -0
- data/lib/ruby_swizz.rb +34 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 25213cf1aac86fbd2fcab18bbb5782eed8d3a9609d16e036b1156912efc6102d
|
|
4
|
+
data.tar.gz: a07d50414062d0672df9508060e7f81cb62bfe56246a1494c8ea6356b5e11c1f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7bf469bf759f2bb9f5bd23a37e41bb4d9bc2da21e981672021911d831c71b60a59b60dc98c409a66cbd316f989c1307b479b87c63abd8c49c956d727e4497fcf
|
|
7
|
+
data.tar.gz: '00776759564e894d79ec3bdf867b26b8043c8226f8466f3532e8bb34bc016d1898ea5423321f55dade5e7b33ae90ab9f0b9efa9f1f39c11d6081999e23de9023'
|
data/bin/ruby_swizz
ADDED
data/lib/ruby_swizz.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'date'
|
|
2
|
+
|
|
3
|
+
class RubySwizz
|
|
4
|
+
class << self
|
|
5
|
+
def beats_time(time_input = nil)
|
|
6
|
+
@time = time_check(time_input)
|
|
7
|
+
@swatch_beats = convert_to_beats
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def convert_to_beats
|
|
13
|
+
# Calculate the total seconds elapsed since midnight
|
|
14
|
+
total_seconds = @time.hour * 3600 + @time.min * 60 + @time.sec
|
|
15
|
+
|
|
16
|
+
# Calculate the Swatch Beats
|
|
17
|
+
beetz = (total_seconds / 86.4).floor
|
|
18
|
+
|
|
19
|
+
# Return the Swatch Beats
|
|
20
|
+
beetz
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def time_check(inpt)
|
|
24
|
+
return DateTime.now.new_offset(1.0/24) if inpt.nil?
|
|
25
|
+
if inpt.is_a? String
|
|
26
|
+
begin
|
|
27
|
+
DateTime.parse(inpt).new_offset(1.0/24)
|
|
28
|
+
rescue
|
|
29
|
+
DateTime.now.new_offset(1.0/24)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rubyswizz
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.2.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Kaz Red Archer
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2024-02-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: simple swatch time library.
|
|
14
|
+
email: ''
|
|
15
|
+
executables:
|
|
16
|
+
- ruby_swizz
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- bin/ruby_swizz
|
|
21
|
+
- lib/ruby_swizz.rb
|
|
22
|
+
homepage: https://rubygems.org/gems/ruby_swizz
|
|
23
|
+
licenses:
|
|
24
|
+
- GPL-2.0
|
|
25
|
+
metadata: {}
|
|
26
|
+
post_install_message:
|
|
27
|
+
rdoc_options: []
|
|
28
|
+
require_paths:
|
|
29
|
+
- lib
|
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '0'
|
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
requirements: []
|
|
41
|
+
rubygems_version: 3.5.0.dev
|
|
42
|
+
signing_key:
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: it tells swatch time.
|
|
45
|
+
test_files: []
|