attribeauty 0.4.6 → 0.4.7

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: e043b4e5f8fcbdfd096c6cd5deabfca25667b5c0e3a2754b8106f250e12569cd
4
- data.tar.gz: 450ccb28494f3b5dbde4d3f56113997bf5d3e85dfb6fee82a1f683ca85e7523e
3
+ metadata.gz: c3e7fb42086d75e28fa5c80ff5718c7de734759a0bce85df5b3fd48a2fabbbaf
4
+ data.tar.gz: 2a08c818e591cd8b4a780d275f2323c76842c7095a2de878bda7bfaab357ef0c
5
5
  SHA512:
6
- metadata.gz: a44271c47fdec0e64fcfa8bae79b426d88a67b3c5eae25201c7ce675f1b9188308dfb5c13df908c3701bef1f7350bf786becf0d395b6ff5ce918d2706f4a6bed
7
- data.tar.gz: '048046380ad6ac7c65b7406beeb222ee553beea2bed15ea2b855dfdac4b19243537046caeb579d21eb3d536b3e758323f38e6cfb0cbec8d8fea90284331aca00'
6
+ metadata.gz: 970ede789c687fd334b84555b610940e3862672166269a2b39055c942f79a7466371f4a05d35bc658b5b455914281e5cde607e9a41da84c49e7554d58df935b7
7
+ data.tar.gz: 2e7a482d54b2487169cb63380eb641a42a3bc03a1fecd25028ed917e2184110bdd658173924de55ff7440c7101c3a93b5f42bf182f2e58c90a6e874ef4406a86
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.7] - 2024-07-01
4
+
5
+ - generate for fix, and added strict option.
6
+ - handle stringifying keys with root
7
+
3
8
  ## [0.4.6] - 2024-06-28
4
9
 
5
10
  - unofficial support for auto generating rails models params filtering
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attribeauty (0.4.6)
4
+ attribeauty (0.4.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -44,7 +44,7 @@ module Attribeauty
44
44
  end
45
45
 
46
46
  def root(name)
47
- @request_params = request_params[name]
47
+ @request_params = request_params[name].transform_keys(&:to_sym)
48
48
 
49
49
  yield
50
50
  end
@@ -68,6 +68,9 @@ module Attribeauty
68
68
  strict
69
69
  end
70
70
 
71
+ # in Rails if you have a user model you can call
72
+ # Attribeauty::Params.with(params.to_unsafe_h).generate_for(User, :username, :name, :age, :email)
73
+ # It will grab the type, and add an exclude_if: for all with Null false
71
74
  def generate_for(model, *columns)
72
75
  raise "Method requires Rails" unless defined?(Rails)
73
76
 
@@ -80,6 +83,14 @@ module Attribeauty
80
83
  attribute(*attrs)
81
84
  end
82
85
  end
86
+
87
+ self
88
+ end
89
+
90
+ def generate_for!(model, *columns)
91
+ @strict = true
92
+
93
+ generate_for(model, *columns)
83
94
  end
84
95
 
85
96
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Attribeauty
4
- VERSION = "0.4.6"
4
+ VERSION = "0.4.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attribeauty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-27 00:00:00.000000000 Z
11
+ date: 2024-07-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: There are so many of these, I just needed this one.
14
14
  email: