pastore 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: 995ad5e50f20279c2e14208bef2a61ead6e26a2e10a0f92c84eec77c24ae5a4d
4
- data.tar.gz: 7f34397427f2ab4ef31945dd3b8556750f84aeb080451403cbd91dfe9d467829
3
+ metadata.gz: cbd91d887bce717ba67bfec4b7468fb2e637471bbde99a4b5f84fddb96c3b775
4
+ data.tar.gz: 7a935d0e120b5f15f89bddb2bde47d1df126686355fc6210e07611117273c9b4
5
5
  SHA512:
6
- metadata.gz: 8b79de1d7e1bcefeec13a267a618d6fcdea85fbc291fde42226880f7e74d7f643e416a77dc920ae6625a5b79bf8975891a483baca6fd372a52ca3a0e9693fd93
7
- data.tar.gz: 70c787f21ba2dc72871120b33ae433288c1de6e971ac95d37c05f52884055fbcf37669177326893379a869b7ecfac9d695fe0aa04a3d364ea6e5af025112ecf0
6
+ metadata.gz: cd68dd37a52969a086bd6349ed71fb14f7c4fc6ee21e224d939b9316b34d13b98382042737a8111c9a4ff3d843bcd33df364c7db917255505a1b15f0d28df4dc
7
+ data.tar.gz: 13a30ad866732985887d329f6df15af4e4f79b48436cf71eab89dec6939ff1e186ae7d404223f094fbc4f0d05ab2a5b970a37c2fe761aaf27a6d0a00871f2109
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2023-02-16
4
+
5
+ - [NEW] Implemented the feature which allows to get the current role with `#current_role` method inside controllers actions.
6
+
7
+ ## [0.1.1] - 2023-02-14
8
+
9
+ - [FIX] Accept `Array` values as valid falues for `:object` params.
10
+
3
11
  ## [0.1.0] - 2023-02-13
4
12
 
5
13
  - [NEW] Implemented `Pastore::Params` feature for params validation.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pastore (0.1.0)
4
+ pastore (0.2.0)
5
5
  rails (>= 4.0)
6
6
 
7
7
  GEM
data/docs/Params.md CHANGED
@@ -71,7 +71,7 @@ class UsersController < ApplicationController
71
71
  param :name, type: :string, allow_blank: false
72
72
  # For string params you can set a format regexp validation, which will be automatically applied
73
73
  param :email, type: :string, required: true, format: URI::MailTo::EMAIL_REGEXP,
74
- modifier: -> { |v| v.strip.downcase }
74
+ modifier: ->(v) { v.strip.downcase }
75
75
  param :birth_date, type: :date, required: true, max: DateTime.now
76
76
  end
77
77
  # You can also specify the scope inline
@@ -24,6 +24,10 @@ module Pastore
24
24
  end
25
25
  end
26
26
 
27
+ def current_role
28
+ self.class.pastore_guards.current_role(self)
29
+ end
30
+
27
31
  class_methods do # rubocop:disable Metrics/BlockLength
28
32
  attr_accessor :_pastore_guards
29
33
 
@@ -28,7 +28,7 @@ module Pastore
28
28
  end
29
29
 
30
30
  def check_if_object!
31
- return true if [Hash, HashWithIndifferentAccess, ActionController::Parameters].include?(value.class)
31
+ return true if [Hash, HashWithIndifferentAccess, ActionController::Parameters, Array].include?(value.class)
32
32
 
33
33
  # When value is a string, try to parse it as JSON
34
34
  if value.is_a?(String)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pastore
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pastore
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
  - Groza Sergiu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-13 00:00:00.000000000 Z
11
+ date: 2023-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails