mk_calendar 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +102 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/mk_calendar +34 -0
- data/lib/mk_calendar/argument.rb +30 -0
- data/lib/mk_calendar/calendar.rb +1137 -0
- data/lib/mk_calendar/const.rb +60 -0
- data/lib/mk_calendar/version.rb +3 -0
- data/lib/mk_calendar.rb +13 -0
- data/mk_calendar.gemspec +33 -0
- metadata +103 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
module MkCalendar
|
2
|
+
module Const
|
3
|
+
USAGE = "[USAGE] `MkCalendar.new(半角数字8桁)` or `MkCalendar.new`"
|
4
|
+
MSG_ERR_1 = "[ERROR] 妥当な日付ではありません。"
|
5
|
+
PI = 3.141592653589793238462
|
6
|
+
K = 0.017453292519943295
|
7
|
+
JST_D = 0.375 # = 9.0 / 24.0
|
8
|
+
YOBI = ["日", "月", "火", "水", "木", "金", "土"]
|
9
|
+
ROKUYO = ["大安", "赤口", "先勝", "友引", "先負", "仏滅"]
|
10
|
+
KANSHI = [
|
11
|
+
"甲子", "乙丑", "丙寅", "丁卯", "戊辰", "己巳", "庚午", "辛未", "壬申", "癸酉",
|
12
|
+
"甲戌", "乙亥", "丙子", "丁丑", "戊寅", "己卯", "庚辰", "辛巳", "壬午", "癸未",
|
13
|
+
"甲申", "乙酉", "丙戌", "丁亥", "戊子", "己丑", "庚寅", "辛卯", "壬辰", "癸巳",
|
14
|
+
"甲午", "乙未", "丙申", "丁酉", "戊戌", "己亥", "庚子", "辛丑", "壬寅", "癸卯",
|
15
|
+
"甲辰", "乙巳", "丙午", "丁未", "戊申", "己酉", "庚戌", "辛亥", "壬子", "癸丑",
|
16
|
+
"甲寅", "乙卯", "丙辰", "丁巳", "戊午", "己未", "庚申", "辛酉", "壬戌", "癸亥"
|
17
|
+
]
|
18
|
+
SEKKI_24 = [
|
19
|
+
"春分", "清明", "穀雨", "立夏", "小満", "芒種",
|
20
|
+
"夏至", "小暑", "大暑", "立秋", "処暑", "白露",
|
21
|
+
"秋分", "寒露", "霜降", "立冬", "小雪", "大雪",
|
22
|
+
"冬至", "小寒", "大寒", "立春", "雨水", "啓蟄"
|
23
|
+
]
|
24
|
+
SEKKU = [
|
25
|
+
[0, 1, 7, "人日"],
|
26
|
+
[1, 3, 3, "上巳"],
|
27
|
+
[2, 5, 5, "端午"],
|
28
|
+
[3, 7, 7, "七夕"],
|
29
|
+
[4, 9, 9, "重陽"]
|
30
|
+
]
|
31
|
+
ZASSETSU = [
|
32
|
+
"節分" , "彼岸入(春)", "彼岸(春)" , "彼岸明(春)",
|
33
|
+
"社日(春)" , "土用入(春)", "八十八夜" , "入梅" ,
|
34
|
+
"半夏生" , "土用入(夏)", "二百十日" , "二百二十日",
|
35
|
+
"彼岸入(秋)", "彼岸(秋)" , "彼岸明(秋)", "社日(秋)" ,
|
36
|
+
"土用入(秋)", "土用入(冬)"
|
37
|
+
]
|
38
|
+
HOLIDAY = [
|
39
|
+
[ 0, 1, 1, 99, "元日" ],
|
40
|
+
[ 1, 1, 99, 21, "成人の日" ],
|
41
|
+
[ 2, 2, 11, 99, "建国記念の日"],
|
42
|
+
[ 3, 3, 99, 80, "春分の日" ],
|
43
|
+
[ 4, 4, 29, 99, "昭和の日" ],
|
44
|
+
[ 5, 5, 3, 99, "憲法記念日" ],
|
45
|
+
[ 6, 5, 4, 99, "みどりの日" ],
|
46
|
+
[ 7, 5, 5, 99, "こどもの日" ],
|
47
|
+
[ 8, 7, 99, 31, "海の日" ],
|
48
|
+
[ 9, 8, 11, 99, "山の日" ],
|
49
|
+
[10, 9, 99, 31, "敬老の日" ],
|
50
|
+
[11, 9, 99, 81, "秋分の日" ],
|
51
|
+
[12, 10, 99, 21, "体育の日" ],
|
52
|
+
[13, 11, 3, 99, "文化の日" ],
|
53
|
+
[14, 11, 23, 99, "勤労感謝の日"],
|
54
|
+
[15, 12, 23, 99, "天皇誕生日" ],
|
55
|
+
[90, 99, 99, 99, "国民の休日" ],
|
56
|
+
[91, 99, 99, 99, "振替休日" ]
|
57
|
+
]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
data/lib/mk_calendar.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "mk_calendar/version"
|
2
|
+
require "mk_calendar/argument"
|
3
|
+
require "mk_calendar/const"
|
4
|
+
require "mk_calendar/calendar"
|
5
|
+
|
6
|
+
module MkCalendar
|
7
|
+
def self.new(arg = ARGV[0])
|
8
|
+
arg ||= Time.now.strftime("%Y%m%d")
|
9
|
+
ymd = MkCalendar::Argument.new(arg).get_ymd
|
10
|
+
return if ymd == []
|
11
|
+
return MkCalendar::Calendar.new(ymd)
|
12
|
+
end
|
13
|
+
end
|
data/mk_calendar.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mk_calendar/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mk_calendar"
|
8
|
+
spec.version = MkCalendar::VERSION
|
9
|
+
spec.authors = ["komasaru"]
|
10
|
+
spec.email = ["masaru@mk-mode.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Calendar library including Japan's old-calendar.}
|
13
|
+
spec.description = %q{MkCalendar is a calendar library including Japan's old-calendar.}
|
14
|
+
spec.homepage = "https://github.com/komasaru/mk_calendar"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem 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 public gem pushes."
|
23
|
+
#end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mk_calendar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- komasaru
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: MkCalendar is a calendar library including Japan's old-calendar.
|
56
|
+
email:
|
57
|
+
- masaru@mk-mode.com
|
58
|
+
executables:
|
59
|
+
- mk_calendar
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- exe/mk_calendar
|
73
|
+
- lib/mk_calendar.rb
|
74
|
+
- lib/mk_calendar/argument.rb
|
75
|
+
- lib/mk_calendar/calendar.rb
|
76
|
+
- lib/mk_calendar/const.rb
|
77
|
+
- lib/mk_calendar/version.rb
|
78
|
+
- mk_calendar.gemspec
|
79
|
+
homepage: https://github.com/komasaru/mk_calendar
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata: {}
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.6.4
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: Calendar library including Japan's old-calendar.
|
103
|
+
test_files: []
|