nx-date-time 0.1.0 → 0.1.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 +4 -4
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/__tests__/api.rb +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/nx/date-time.rb +34 -0
- data/lib/nx/version.rb +5 -0
- data/nx-date-time-0.1.0.gem +0 -0
- data/nx-date-time.gemspec +35 -0
- data/package.json +24 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf328cc6354065ae6df47a226dc7af9499efabdebbe0e42af60a5c91689d99dc
|
4
|
+
data.tar.gz: '08b819ca37bfb00cfbd4adb38853d202b1550f757b5223c10ee17170009d7164'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6cbb03b1d086156dbfbb9c32b37c4849a9c08442b21cefefb61e21c777957512692d2587e86860315ecb3b85ac3e22556cda20d7fd3f6cb0f24ab6113053c6b
|
7
|
+
data.tar.gz: 4077bdabecf7bdd92d1e1cabee27c37aea589b779097c53bc3693f65d9cb34869e3062c2f50f48a96174100753956e71291e00cd20fe6aaafbebaf75637ffacf
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# nx-date-time
|
2
|
+
> Date time utility for nx.
|
3
|
+
|
4
|
+
## installation
|
5
|
+
```rb
|
6
|
+
# from gem
|
7
|
+
gem 'nx-date-time'
|
8
|
+
# from git
|
9
|
+
gem 'nx-date-time', git: 'git@github.com:afeiship/nx-date-time.git'
|
10
|
+
```
|
11
|
+
|
12
|
+
## usage
|
13
|
+
```rb
|
14
|
+
require "nx-date-time"
|
15
|
+
|
16
|
+
puts Nx::DateTime.now
|
17
|
+
puts Nx::DateTime.date
|
18
|
+
puts Nx::DateTime.time
|
19
|
+
puts Nx::DateTime.date_time
|
20
|
+
puts Nx::DateTime.ym
|
21
|
+
puts Nx::DateTime.ymd_hms
|
22
|
+
|
23
|
+
|
24
|
+
# 1584281622
|
25
|
+
# 2020-03-15
|
26
|
+
# 22:13:42
|
27
|
+
# 2020-03-15 22:13:42
|
28
|
+
# 2020-03
|
29
|
+
# 20200315_221342
|
30
|
+
```
|
31
|
+
|
32
|
+
## build/publish
|
33
|
+
```shell
|
34
|
+
# build
|
35
|
+
gem build nx-date-time.gemspec
|
36
|
+
|
37
|
+
# publish
|
38
|
+
gem push nx-date-time-0.1.0.gem
|
39
|
+
```
|
data/Rakefile
ADDED
data/__tests__/api.rb
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "nx-date-time"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/nx/date-time.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Nx
|
2
|
+
class DateTime
|
3
|
+
class << self
|
4
|
+
def now
|
5
|
+
Time.now.to_i
|
6
|
+
end
|
7
|
+
|
8
|
+
def format(fmt)
|
9
|
+
time = Time.now
|
10
|
+
time.strftime(fmt)
|
11
|
+
end
|
12
|
+
|
13
|
+
def date
|
14
|
+
format "%Y-%m-%d"
|
15
|
+
end
|
16
|
+
|
17
|
+
def time
|
18
|
+
format "%H:%M:%S"
|
19
|
+
end
|
20
|
+
|
21
|
+
def date_time
|
22
|
+
format "%Y-%m-%d %H:%M:%S"
|
23
|
+
end
|
24
|
+
|
25
|
+
def ym
|
26
|
+
format "%Y-%m"
|
27
|
+
end
|
28
|
+
|
29
|
+
def ymd_hms
|
30
|
+
format "%Y%m%d_%H%M%S"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/nx/version.rb
ADDED
Binary file
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "nx/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "nx-date-time"
|
8
|
+
spec.version = Nx::DateTime::VERSION
|
9
|
+
spec.licenses = ["MIT"]
|
10
|
+
spec.authors = ["afeiship"]
|
11
|
+
spec.email = ["1290657123@qq.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{Date time utility.}
|
14
|
+
spec.description = %q{Date time utility for nx.}
|
15
|
+
spec.homepage = "https://github.com/afeiship/nx-date-time"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
34
|
+
spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
|
35
|
+
end
|
data/package.json
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"name": "nx-date-time",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "Date time utility for nx.",
|
5
|
+
"directories": {
|
6
|
+
"lib": "lib"
|
7
|
+
},
|
8
|
+
"scripts": {
|
9
|
+
"clean": "rm -rf *.gem",
|
10
|
+
"build": "gem build *.gemspec",
|
11
|
+
"pubpush": "gem push *.gem",
|
12
|
+
"unpublish":"gem yank nx-http -v '0.1.0'"
|
13
|
+
},
|
14
|
+
"repository": {
|
15
|
+
"type": "git",
|
16
|
+
"url": "git+https://github.com/afeiship/nx-date-time.git"
|
17
|
+
},
|
18
|
+
"author": "afei",
|
19
|
+
"license": "MIT",
|
20
|
+
"bugs": {
|
21
|
+
"url": "https://github.com/afeiship/nx-date-time/issues"
|
22
|
+
},
|
23
|
+
"homepage": "https://github.com/afeiship/nx-date-time#readme"
|
24
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nx-date-time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- afeiship
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,7 +51,19 @@ executables: []
|
|
51
51
|
extensions: []
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
|
+
- ".gitignore"
|
55
|
+
- Gemfile
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- __tests__/api.rb
|
59
|
+
- bin/console
|
60
|
+
- bin/setup
|
54
61
|
- lib/nx-date-time.rb
|
62
|
+
- lib/nx/date-time.rb
|
63
|
+
- lib/nx/version.rb
|
64
|
+
- nx-date-time-0.1.0.gem
|
65
|
+
- nx-date-time.gemspec
|
66
|
+
- package.json
|
55
67
|
homepage: https://github.com/afeiship/nx-date-time
|
56
68
|
licenses:
|
57
69
|
- MIT
|