vehicle_coding_ph 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7790a98d788d118582d3e16cb5756fcde0a9090cc1a3f9e6fe917914bec3032
4
- data.tar.gz: fb3dc654a2eb0e248dc18d8dce9c0dddff929a383a547c44c5f5337fa89a2763
3
+ metadata.gz: 3cc0616b90c86b72c8cca57b1c565f60f06d8d8516969eb87c4ce47c21999556
4
+ data.tar.gz: 0d4b7e37ae873cafa2f5a09bc1991f7b3e016c5579fff48ad8ff2418f401aa68
5
5
  SHA512:
6
- metadata.gz: a225c440f231a842576c7ee7c3c975e30950ec9cf7ae57eaaab563c9af16a6c235875d492e65fc200c0adf3997661b9b94b3fe39a3403ee2c1bb688c173efa16
7
- data.tar.gz: 385042c42c2ab3d63be9559dad7a5d9224fb1f598e900a9449d8ff8ee82930ad7a974d10c8799407a44dbe1acdf9f97830d4f9d1d08d70362dad225bd092ba28
6
+ metadata.gz: 2ad16c1745314249a63a32370c8d52d46ce287e1fbd923c6af46c0d44d897ef50c7380a098f8c93fbcb0163120b6ce27e8a807e2b7966d5fe134cd398ff1bb07
7
+ data.tar.gz: 67b1f47d2469f4a620e2aef2c64958d0f7113e4cad2ba0650a3045cb3f966a80a84c59a4475dd8d8140462916bc6df446ece9df856ce9efa609bd4147dd6bf63
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vehicle_coding_ph (0.1.0)
4
+ vehicle_coding_ph (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -24,7 +24,10 @@ Or install it yourself as:
24
24
 
25
25
  ```ruby
26
26
  # Returns true if allowed to drive today; otherwise it's false
27
- VehicleCodingPh::Checker.(plate_number_of_your_vehicle)
27
+ VehicleCodingPh::Checker.(
28
+ plate_number_of_your_vehicle,
29
+ date # if not passed, defaults to date today
30
+ )
28
31
  ```
29
32
 
30
33
  ## Development
@@ -35,7 +38,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
35
38
 
36
39
  ## Contributing
37
40
 
38
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/coding_ph. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vehicle_coding_ph. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
39
42
 
40
43
  ## License
41
44
 
@@ -1,18 +1,16 @@
1
1
  module VehicleCodingPh
2
2
  class Checker
3
3
 
4
- def self.call(plate_no)
5
- today = Date.today
6
-
7
- return true if weekend?(today)
4
+ def self.call(plate_no, date = Date.today)
5
+ return true if weekend?(date)
8
6
 
9
7
  last_digit = plate_no[-1]
10
- today = Date::DAYNAMES[today.cwday]
8
+ day_today = Date::DAYNAMES[date.cwday]
11
9
 
12
10
  mapping = VehicleCodingPh::PLATE_TO_DAY_MAPPING.
13
- select { |day, _| day == today }
11
+ select { |day, digits| day == day_today }
14
12
 
15
- !mapping[today].include?(last_digit)
13
+ !mapping[day_today].include?(last_digit)
16
14
  end
17
15
 
18
16
  def self.weekend?(date)
@@ -1,3 +1,3 @@
1
1
  module VehicleCodingPh
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vehicle_coding_ph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez