unix_like_permissions 0.4.13 → 0.4.14

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: c8078deb84ac8306f4eeec8f52a9b1bc470578ee894cd051cf0ae123b920b360
4
- data.tar.gz: 6392731df25b5cb8f014a117ec4de89d26bd90e274526faca801dcfe6b08b5ae
3
+ metadata.gz: 583c2f274060a612eb4ed7b65e060ffef8409b91be16b64f2b98cc6cd7c77516
4
+ data.tar.gz: 0ff33eb590f08c805bc96a6e18af5fe36f894e8061820d7ff9939306c9a4ac80
5
5
  SHA512:
6
- metadata.gz: f6ee6be113f3e935be36b65251aab44776059390e0e1befe05c68f3e030601251b91cdbb23c4eeb1fefcfe23e9d92da2aa10eaa1db0e51486408382c3dc429fd
7
- data.tar.gz: 8eda9ea4bc7fe2da0fff16926fb9f70b6779e7538b52602bb286b61658c087194f20ab621994138b0a322ebbfac7542d14607fc96107fc99a22fb8072cb69a49
6
+ metadata.gz: 2e469e0719e68842d50cd2f86f5d5132458f1b79138038537b8cc93b343da3a94ce9ccfefbc73e7471fdd49db8e5bc6a0ccda3d94dfdeb1e14018e1a1f9d5688
7
+ data.tar.gz: d6566442fbf3ba841a4a01c6435d13c167eea76f100eff4255d161557ce770fcaccc0a43b8c72b4b8ad73ce779ee8846f70a66ef74e21b87ae6c2ce20b581ebe
data/README.md CHANGED
@@ -155,9 +155,11 @@ permissions.to_i # => 4
155
155
 
156
156
  #### Serialization
157
157
 
158
- `#to_h`: Returns a hash with permission names as keys and boolean values indicating whether each permission is set.
158
+ `#to_h(type = :bool)`: Returns a hash with permission names as keys and boolean values indicating whether each permission is set.
159
159
  ```ruby
160
160
  permissions.to_h # => { read: false, create: false, update: true, destroy: false }
161
+ permissions.to_h(:int) # => { read: 0, create: 0, update: 1, destroy: 0 }
162
+ permissions.to_h(:str) # => { read: '0', create: '0', update: '1', destroy: '0' }
161
163
  ```
162
164
 
163
165
  `#to_s`: Returns a string representation of the set permissions.
@@ -180,10 +182,10 @@ permissions.to_a(:str) # => ['0', '0', '1', '0]
180
182
  ```ruby
181
183
  permissions.set_all(true)
182
184
 
183
- permissions.to_s # => "read, create, update, destroy"
185
+ permissions.to_s # => "read create update destroy"
184
186
  ```
185
187
 
186
- set({ permission: value, ... }): Sets the specified permission to the boolean value provided (true or false).
188
+ `set({ permission: value, ... })`: Sets the specified permission to the boolean value provided (true or false).
187
189
 
188
190
  ```ruby
189
191
  permissions.set(read: true, create: false)
@@ -192,7 +194,7 @@ permissions.to_s # => "read"
192
194
 
193
195
  ## Contributing
194
196
 
195
- Bug reports and pull requests are welcome on GitHub at [repository URL]. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](link to code of conduct).
197
+ Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](CODE_OF_CONDUCT.md).
196
198
 
197
199
  ## License
198
200
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UnixLikePermissions
4
- VERSION = "0.4.13"
4
+ VERSION = "0.4.14"
5
5
  end
@@ -13,9 +13,14 @@ module UnixLikePermissions
13
13
  end
14
14
 
15
15
  def load_permissions_map!(permissions)
16
+ PermissionSeries.send(:remove_const, :PERMISSIONS_MAP_WAS) if defined?(PermissionSeries::PERMISSIONS_MAP_WAS)
16
17
  PermissionSeries.const_set(:PERMISSIONS_MAP_WAS, PermissionSeries::PERMISSIONS_MAP)
18
+
19
+ PermissionSeries.send(:remove_const, :PERMISSIONS_MAP) if defined?(PermissionSeries::PERMISSIONS_MAP)
17
20
  PermissionSeries.const_set(:PERMISSIONS_MAP, permissions_map(permissions))
21
+
18
22
  PermissionSeries::PERMISSIONS_MAP.freeze
23
+ PermissionSeries::PERMISSIONS_MAP_WAS.freeze
19
24
 
20
25
  PermissionSeries.define_getters!
21
26
  puts "Permission map loaded: #{PermissionSeries::PERMISSIONS_MAP}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unix_like_permissions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.13
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Your Name
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-07 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec