vehicle_coding_ph 1.1.1 → 1.2.0

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
  SHA256:
3
- metadata.gz: c5c4f4e63a646bcb16fe9a50366e1438e8465939b815a376192c857fdc0aac31
4
- data.tar.gz: 6f71b895af80dde97f34114daaa78d1cd529f6fb8a94f4429225b83c115d84a9
3
+ metadata.gz: bfabb96edaefb820f72fb034babb4580eceb44c4b385a68d63299bc1beedcdf9
4
+ data.tar.gz: d28debcd5713a9cfdbbcb335fb306ccae601ba364fd142003f30424d5539a1d0
5
5
  SHA512:
6
- metadata.gz: 1cf62292fc9e3bc19b52236f14355637d1a7be5cde2d131162e7d2959d8881b8bbecd9555c6e093e0227a94ec3d708e4558b135a8ddc3370eda0bdd0bb4a7057
7
- data.tar.gz: 573fbfe693699c44ba9d4e8ecd038e205c33d21dc215aae6d6f574661e89329eca94e57ea64f390f38f45120b5efb89abc6f33fca7c0108c541ec1d62327cf70
6
+ metadata.gz: f3fd45fbb2083812c8fc3c987c7063d39576ef853dce6603c66e1803ceb7c2d65303f29704ac84f881d065d3e2ccad629dd680b54dcc2eb197cde6e68dff5b21
7
+ data.tar.gz: 380a4bd8ee6c04567112af7db46164a0eba4d4a1cb988f0986f1044d12c08b51290822a260a8330097fb998a502a7efa9098591eb67af7c73f52f2990b6224af
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vehicle_coding_ph (1.1.1)
4
+ vehicle_coding_ph (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -4,11 +4,6 @@
4
4
 
5
5
  Helps you figure out if your car is legally okay to drive on a given date in the Philippines.
6
6
 
7
- ## Version 1.0 roadmap
8
-
9
- - [x] Response object
10
- - [x] Consider window hours
11
-
12
7
  ## Installation
13
8
 
14
9
  Add this line to your application's Gemfile:
@@ -33,6 +28,11 @@ VehicleCodingPh::Checker.(
33
28
  plate_number_of_your_vehicle,
34
29
  datetime # if not passed, defaults to datetime today
35
30
  )
31
+
32
+ # VehicleCodingPh::Response object returns:
33
+ - coding: boolean
34
+ - allowed: array of areas allowed to go
35
+ - not_allowed: array of areas not allowed to go
36
36
  ```
37
37
 
38
38
  ## Development
@@ -43,7 +43,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
43
43
 
44
44
  ## Contributing
45
45
 
46
- 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.
46
+ Bug reports and pull requests are welcome on GitHub at https://github.com/MarkFChavez/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.
47
47
 
48
48
  ## License
49
49
 
@@ -51,4 +51,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
51
51
 
52
52
  ## Code of Conduct
53
53
 
54
- Everyone interacting in the CodingPh project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/vehicle_coding_ph/blob/master/CODE_OF_CONDUCT.md).
54
+ Everyone interacting in the CodingPh project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/MarkFChavez/vehicle_coding_ph/blob/master/CODE_OF_CONDUCT.md).
@@ -5,22 +5,19 @@ module VehicleCodingPh
5
5
  return allowed_anywhere if weekend?(datetime)
6
6
  return allowed_anywhere if not coding?(plate_no, datetime)
7
7
 
8
- hour_of_the_day = datetime.hour
9
-
10
- allowed_areas = VehicleCodingPh::AREA_TO_HOUR_MAPPING.reduce([]) do |areas, mapping|
11
- areas ||= []
12
-
13
- name_of_area = mapping[0]
14
- coding_hours = mapping[1]
15
-
16
- if coding_hours.empty? || !coding_hours.include?(hour_of_the_day)
17
- areas << name_of_area
8
+ allowed_areas = []
9
+ not_allowed_areas = []
10
+ hour_of_the_day = datetime.hour
11
+
12
+ VehicleCodingPh::AREA_TO_HOUR_MAPPING.each do |area, hours|
13
+ if hours.empty? || !hours.include?(hour_of_the_day)
14
+ allowed_areas << area
15
+ else
16
+ not_allowed_areas << area
18
17
  end
19
-
20
- areas
21
18
  end
22
19
 
23
- Response.new(true, allowed_areas)
20
+ Response.new(true, allowed_areas, not_allowed_areas)
24
21
  end
25
22
 
26
23
  def self.weekend?(datetime)
@@ -40,7 +37,7 @@ module VehicleCodingPh
40
37
  private_class_method :coding?
41
38
 
42
39
  def self.allowed_anywhere
43
- Response.new(false, [:anywhere])
40
+ Response.new(false, [:anywhere], [])
44
41
  end
45
42
  private_class_method :allowed_anywhere
46
43
 
@@ -1,11 +1,12 @@
1
1
  module VehicleCodingPh
2
2
  class Response
3
3
 
4
- attr_reader :coding, :allowed_areas
4
+ attr_reader :coding, :allowed, :not_allowed
5
5
 
6
- def initialize(coding, areas)
6
+ def initialize(coding, allowed, not_allowed)
7
7
  @coding = coding
8
- @allowed_areas = areas
8
+ @allowed = allowed
9
+ @not_allowed = not_allowed
9
10
  end
10
11
 
11
12
  end
@@ -1,3 +1,3 @@
1
1
  module VehicleCodingPh
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vehicle_coding_ph
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-14 00:00:00.000000000 Z
11
+ date: 2020-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler