what_day 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/lib/what_day/client.rb +5 -4
- data/lib/what_day/version.rb +1 -1
- data/what_day.gemspec +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f501a029843fc421fab85e7cff9980c00e7097d8
|
4
|
+
data.tar.gz: 87da28434105b4a76db67742d7779dcf4e05b385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b82cbab8648d1a0a683e2355cbe6494744ab6dafd1c10c1e62cd0efe77b90531be80c92c938d9fce11e3785f17b23ed289350a34f2364ebd0827c4a598b2751
|
7
|
+
data.tar.gz: cce6b79677a201d449d341e4eaed3b651b6fdab255e22d524c911c7e1f8fcaef50db6ae4b555bb79121aaf9a425bd8d28dc41ed4edeebc313a5657c74d1cac45
|
data/.travis.yml
CHANGED
data/lib/what_day/client.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
module WhatDay
|
2
2
|
class Client
|
3
3
|
|
4
|
+
MONTHS = '(jan||feb||mar||apr||may||jun||jul||aug||sep||oct||nov||dec||january||february||march||april||may||june||july||august||september||october||november||december||sept)'.freeze
|
5
|
+
|
4
6
|
def day(date)
|
5
7
|
begin
|
6
|
-
|
7
|
-
Date::DAYS_INTO_WEEK.key(day_int).to_s.capitalize
|
8
|
+
Date::DAYNAMES[date.wday]
|
8
9
|
rescue ArgumentError
|
9
10
|
nil
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
14
|
def method_missing(name, *args, &block)
|
14
|
-
if name.to_s =~
|
15
|
+
if name.to_s =~ Regexp.new("^(beginning||end)_of_#{MONTHS}_\\d+$", true)
|
15
16
|
date = parse_date_string(name.to_s)
|
16
17
|
day date
|
17
18
|
else
|
@@ -26,7 +27,7 @@ module WhatDay
|
|
26
27
|
selector = methods[0].downcase
|
27
28
|
month = format_date_string methods[2]
|
28
29
|
year = methods[3].to_i
|
29
|
-
str = "#{year}
|
30
|
+
str = "#{year}-#{month}-1"
|
30
31
|
date = Date.parse str
|
31
32
|
selector == "end" ? date.to_date.end_of_month : date
|
32
33
|
end
|
data/lib/what_day/version.rb
CHANGED
data/what_day.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.bindir = "exe"
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
+
spec.required_ruby_version = ">=2.2.0"
|
24
25
|
|
25
26
|
spec.add_dependency "activesupport", ">= 4.2"
|
26
27
|
spec.add_development_dependency "bundler", "~> 1.13"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: what_day
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
116
|
+
version: 2.2.0
|
117
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
118
|
requirements:
|
119
119
|
- - ">="
|