policy_check 0.1.0 → 0.1.1

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: b9da007a15a7dec7f84d7752477e67a5ad9e157adba82d5927809770f25fa561
4
- data.tar.gz: bfc62ac4ecc7cfd5d4647741b508ebea6614ad224bc27fa3cb042d61ec5dce51
3
+ metadata.gz: 1a1e72d0560846575b9f7058c0143f736ba327fff679202f6b50630c6cf87907
4
+ data.tar.gz: c5dcf2ee63df0890a9ef835109b271b88ff0e8adf4648a98755ff4918e8add81
5
5
  SHA512:
6
- metadata.gz: 999496e740414550cc81955aaabf761a0e427d2c37261cb8a1fad61c91c3ff4767f0317ba50c400dca0ec3422d7e4353bfe03e92cb1569e156d2a57bc4064fff
7
- data.tar.gz: 6268828a9de862256b57d6f66b5e7ebbfe7af5ef864c72e876418f042adf3a9a5c2e3296457c447ea46dcc26e7c12e18580fa5114cc46271a05650429e485b31
6
+ metadata.gz: 3621a014b73eda77689c064437c8fbbd267b05b541c6d2b5516f74f3c0841b86282e0194fb60e74f43ad1509fcb83f419919eef600c0f57641111baaae71e266
7
+ data.tar.gz: 3333297547cb1e00b83fb8e4b2d9fba03ca4a00657ea8cc00864a30480374f045ff5d07cffb1db4f26a2e3fd6c4a50c1e39281aadbe4cd1725e2b31cd6957fe5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- policy_check (0.1.0)
4
+ policy_check (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  # PolicyCheck
4
4
 
5
- PolicyCheck provides a DSL for policy definitions and allows you to get reasons for policy violations.
5
+ DSL for policy definitions and allows get reasons for policy violations.
6
6
 
7
7
  ## Installation
8
8
 
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'policy_check', github: 'hazi/policy_check'
12
+ gem 'policy_check'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -19,11 +19,19 @@ And then execute:
19
19
 
20
20
  ## Usage
21
21
 
22
+ ```ruby
23
+ class Post
24
+ extend PolicyCheck #-> only add `.policy` method
25
+ end
26
+ ```
27
+
28
+ ## Example
29
+
22
30
  ### Inline policy
23
31
 
24
32
  ```ruby
25
33
  class Post
26
- extend PolicyCheck #-> only add `.policy` method
34
+ extend PolicyCheck
27
35
 
28
36
  def initialize
29
37
  @status = :draft
@@ -54,7 +62,7 @@ post.publishable? #=> false
54
62
 
55
63
  ```ruby
56
64
  class PostPublishablePolicy
57
- extend PolicyCheck #-> only add `.policy`
65
+ extend PolicyCheck
58
66
 
59
67
  def initialize(post, user)
60
68
  @post = post
@@ -66,7 +74,7 @@ class PostPublishablePolicy
66
74
  !user.admin?
67
75
  end
68
76
 
69
- policy do #-> only create `#valid?` and `#error_messages` method
77
+ policy do #-> only create `#valid?`, `#invalid?` and `#error_messages` method
70
78
  error "user is not admin", &:not_admin?
71
79
  error("status is not `draft`") { post.status != :draft }
72
80
  error("body is empty") { post.body.empty? }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PolicyCheck
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/policy_check.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.authors = ["HAZI"]
13
13
  spec.email = ["yuhei.mukoyama@gmail.com"]
14
14
 
15
- spec.summary = "Create policies for models or policy class"
15
+ spec.summary = "DSL for policy definitions and allows get reasons for policy violations."
16
16
  spec.homepage = "https://github.com/hazi/policy_check"
17
17
  spec.license = "MIT"
18
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: policy_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - HAZI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-31 00:00:00.000000000 Z
11
+ date: 2023-02-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -59,5 +59,5 @@ requirements: []
59
59
  rubygems_version: 3.3.26
60
60
  signing_key:
61
61
  specification_version: 4
62
- summary: Create policies for models or policy class
62
+ summary: DSL for policy definitions and allows get reasons for policy violations.
63
63
  test_files: []