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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8d440f880d9cc0ebe3cb0a1d7c1cd5996eca18f
4
- data.tar.gz: fbdd036de40b302391bf928d6cc21158737235e6
3
+ metadata.gz: f501a029843fc421fab85e7cff9980c00e7097d8
4
+ data.tar.gz: 87da28434105b4a76db67742d7779dcf4e05b385
5
5
  SHA512:
6
- metadata.gz: e6f43da01bc0ec22139584ce5c216ab6c6bd04f045fde8381bc6c530202a3a280e0c38d41e1b2d704a0998ae0c477f77b40e72e96430f8f03d6d6e5b959cb58e
7
- data.tar.gz: 7604759e1a3d447b6f84564e1cc07e673c2e3cb2985576deaf3691f80dc6054c210c249b3f20d359dda2ee002eda4c531f723e42c3e47130cdf824460ef050a9
6
+ metadata.gz: 8b82cbab8648d1a0a683e2355cbe6494744ab6dafd1c10c1e62cd0efe77b90531be80c92c938d9fce11e3785f17b23ed289350a34f2364ebd0827c4a598b2751
7
+ data.tar.gz: cce6b79677a201d449d341e4eaed3b651b6fdab255e22d524c911c7e1f8fcaef50db6ae4b555bb79121aaf9a425bd8d28dc41ed4edeebc313a5657c74d1cac45
@@ -1,5 +1,9 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
+ - 2.2.0
4
5
  - 2.3.0
6
+ - 2.4.0
7
+ - 2.5.0
8
+
5
9
  before_install: gem install bundler -v 1.13.1
@@ -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
- day_int = date.yesterday.wday
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 =~ /^(beginning||end)_of_[a-z]+_\d+$/i
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} #{month}, 1"
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
@@ -1,3 +1,3 @@
1
1
  module WhatDay
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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.0
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-30 00:00:00.000000000 Z
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: '0'
116
+ version: 2.2.0
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
119
  - - ">="