dtg 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90630b4494f916998ff85570d3bb476efe7156132cb7299522c1a5c392ff7f7a
4
+ data.tar.gz: 96b9b6c280a407da5f4f374fc10193595163dee905c80fd4f94a1f2cd91043df
5
+ SHA512:
6
+ metadata.gz: fd84c78104d809ab631f769df0a95a2e41ff88c326f487e58529bdad690696b52a27365d5c901f38244673c9482e110ba706f12dc68104bdaf3a44527119576d
7
+ data.tar.gz: c62e5497ab19a22aba3a0fd78463b33e2fab832885abbfe91dfc682905bbb4ce8a354ae12bc90dc9086a6e212195d3aa105680ef6c26c7b5593f541beedc25d3
@@ -0,0 +1,20 @@
1
+ Copyright 2019 SolarisFlare
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ [![GitHub version](https://badge.fury.io/gh/SolarisFlare%2Fdtg.svg)](https://badge.fury.io/gh/SolarisFlare%2Fdtg)
2
+ [![Build Status](https://travis-ci.org/SolarisFlare/dtg.svg?branch=master)](https://travis-ci.org/SolarisFlare/dtg)
3
+
4
+ # Dtg
5
+ Short description and motivation.
6
+
7
+ ## Usage
8
+ How to use my plugin.
9
+
10
+ ## Installation
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'dtg'
15
+ ```
16
+
17
+ And then execute:
18
+ ```bash
19
+ $ bundle
20
+ ```
21
+
22
+ Or install it yourself as:
23
+ ```bash
24
+ $ gem install dtg
25
+ ```
26
+
27
+ ## Contributing
28
+ Contribution directions go here.
29
+
30
+ ## License
31
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,27 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Dtg'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'test'
23
+ t.pattern = 'test/**/*_test.rb'
24
+ t.verbose = false
25
+ end
26
+
27
+ task default: :test
@@ -0,0 +1,6 @@
1
+ require "dtg/railtie"
2
+ require "dtg/core_ext"
3
+
4
+ module Dtg
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,70 @@
1
+ class Time
2
+ DTG_ZONES = {
3
+ # A: Alpha Time: UTC +01:00 (Paris, France)
4
+ a: +1,
5
+ # B: Bravo Time: UTC +02:00 (Athens, Greece)
6
+ b: +2,
7
+ # C: Charlie Time: UTC +03:00 (Moscow, Russia)
8
+ c: +3,
9
+ # D: Delta Time: UTC +04:00 (Kabul, Afghanistan)
10
+ d: +4,
11
+ # E: Echo Time: UTC +05:00 (New Delhi, India)
12
+ e: +5,
13
+ # F: Foxtrot Time: UTC +06:00 (Dhanka, Bangladesh)
14
+ f: +6,
15
+ # G: Golf Time: UTC +07:00 (Bangkok, Thailand)
16
+ g: +7,
17
+ # H: Hotel Time: UTC +08:00 (Beijing, China)
18
+ h: +8,
19
+ # I: India Time: UTC +09:00 (Tokyo, Japan)
20
+ i: +9,
21
+ # J: Juliet Time: (Local Time Zone)
22
+ j: '',
23
+ # K: Kilo Time: UTC +10:00 (Sydney, Australia)
24
+ k: +10,
25
+ # L: Lima Time: UTC +11:00 (Honiara, Solomon Islands)
26
+ l: +11,
27
+ # M: Mike Time: UTC +12:00 (Wellington, New Zealand)
28
+ m: +12,
29
+ # N: November Time: UTC -01:00 (Azores)
30
+ n: -1,
31
+ # O: Oscar Time: UTC -02:00 (Gothab, Greenland)
32
+ o: -2,
33
+ # P: Papa Time: UTC -03:00 (Buenos Aires, Argentina)
34
+ p: -3,
35
+ # Q: Quebec Time: UTC -04:00 (Halifax, Nova Scotia)
36
+ q: -4,
37
+ # R: Romeo Time: UTC -05:00 (New York, NY United States)
38
+ r: -5,
39
+ # S: Sierra Time: UTC -06:00 (Dallas, TX United States)
40
+ s: -6,
41
+ # T: Tango Time: UTC -07:00 (Denver, CO United States)
42
+ t: -7,
43
+ # U: Uniform Time: UTC -08:00 (Los Angeles, CA United States)
44
+ u: -8,
45
+ # V: Victor Time: UTC -09:00 (Juneau, AK United States)
46
+ v: -9,
47
+ # W: Whiskey Time: UTC -10:00 (Honolulu, HI United States)
48
+ w: -10,
49
+ # X: X-Ray Time: UTC -11:00 (Nome, AK United States)
50
+ x: -11,
51
+ # Y: Yankee Time: UTC -12:00 (Suva, Fiji)
52
+ y: -12,
53
+ # Z: Zulu Time: UTC +-00:00 (Greenwich, England)
54
+ z: 'UTC'
55
+ }
56
+
57
+ def to_dtg(zone = :z)
58
+ self.convert(zone).format(zone)
59
+ end
60
+
61
+ def format(zone = :z)
62
+ dtg = "%d%H%M#{zone.upcase} %b %y"
63
+ self.strftime(dtg)
64
+ end
65
+
66
+ def convert(zone = :z)
67
+ raise "Error: #{zone} is not a valid zone" unless DTG_ZONES.has_key?(zone.downcase)
68
+ (zone.downcase == :j) ? self : self.in_time_zone(DTG_ZONES[zone.downcase])
69
+ end
70
+ end
@@ -0,0 +1,4 @@
1
+ module Dtg
2
+ class Railtie < ::Rails::Railtie
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module Dtg
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :dtg do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dtg
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - SolarisFlare
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-06-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.2.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: "A DTG is a DateTimeGroup which is used in the military to save time.
42
+ \ DTG\n are saved in the format DDHHMML MMM YY, where D is
43
+ day, H is hour, L is \n letter, M is month, and Y is year.
44
+ \ The Month is the 3 character representation\n such as JAN
45
+ for January, MAY for May, DEC for December and so on. Year is only\n the
46
+ last two digits of the year e.g. 2019 is just 19. The letter is the zone\n code
47
+ such as W for whiskey which is HST, Z for zulu which is GMT, A-Z are the \n zones
48
+ used."
49
+ email:
50
+ - shadowbomb20@gmail.com
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - MIT-LICENSE
56
+ - README.md
57
+ - Rakefile
58
+ - lib/dtg.rb
59
+ - lib/dtg/core_ext.rb
60
+ - lib/dtg/railtie.rb
61
+ - lib/dtg/version.rb
62
+ - lib/tasks/dtg_tasks.rake
63
+ homepage: https://github.com/SolarisFlare/dtg/
64
+ licenses:
65
+ - MIT
66
+ metadata:
67
+ allowed_push_host: 'TODO: Set to ''http://mygemserver.com'''
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.7.7
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: DTG converts from a DateTime to a DTG
88
+ test_files: []