strong_arms 0.2.0 → 0.2.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: 23685eb2142510bfc4548b6487562729bb6d53aca759df88a9da0ba1bb037ee8
4
- data.tar.gz: 6086b2ad57b9c22cefcdc9fd4fbdc9c8354dd876e56c5a2c84ce04344618990c
3
+ metadata.gz: abf13ec7439c3395d145329fec3e71771be918952bb27af1560e5cc1c6d89ebb
4
+ data.tar.gz: 8c0885abccebb8110ad12ecf4e244985e29a2c8da0b36c009bfe6c8b02d445be
5
5
  SHA512:
6
- metadata.gz: b08e387370c2e9df00a9045b90ed076c2373c1d8f019e762546e50a6eb51b46c8281ec774bea0bcc13f180aa94d7752dfa977eff85833eed5e2f0be6083f4fc2
7
- data.tar.gz: 609813edde773416b08425e3a0b9da593027d923fb41c1858ea2f92704b74cb9c3ed32d8d424551146780f5efec25b4324ea915cc063a485edaac6d412f37f3c
6
+ metadata.gz: aebad69ebd3084eda3b2bba50ff563a569c7b24fc3be53d7503995b935b8fc53b39a12f42fd4a886ff97c855ca3e3cab05f21e133f932735e388e161630c08df
7
+ data.tar.gz: 9b364805ad03309ea3f2b6191003d67b95e525ab3668ae341872c9eaedffc4e2a8d45c1f0d9fef521352593c1bfd68af408b4ddc19c5eb83b663f2e9c4f5448c
data/README.md CHANGED
@@ -2,13 +2,7 @@
2
2
 
3
3
  A nested parameters friendly alternative to [strong_parameters](https://github.com/rails/strong_parameters) found in Rails.
4
4
 
5
- We love `strong_parameters`, but wanted a cleaner approach for handling deeply nested parameters.
6
-
7
- `permit()` is great for handling a few parameters, but becomes tough to read and prone to user error when describing a deeply nested structure.
8
-
9
- `require()` is great for ensuring top level keys are present, but does not provide a great interface for flagging specific nested parameters.
10
-
11
- Strong Arms provides an interface which makes declaring nested relationships easy, in addition to whitelisting parameters with `permit`, `require` and `ignore`.
5
+ Strong Arms provides a simple whitelisting interface and tells you when it encounters unexpected params.
12
6
 
13
7
  ## Installation
14
8
 
@@ -131,7 +125,7 @@ end
131
125
 
132
126
  ## Nested Parameters
133
127
 
134
- StrongArm handles nested parameters, by specifying a relationship with `many_nested` or `one_nested` methods.
128
+ Strong Arms handles nested parameters, by specifying a relationship with `many_nested` or `one_nested` methods.
135
129
 
136
130
  This is similar to how Rails handles association declarations with `has_many` and `has_one` methods.
137
131
 
@@ -44,7 +44,10 @@ module Utilities
44
44
  if model_alias
45
45
  model_alias.to_s.camelize
46
46
  else
47
- name.to_s.gsub('s_attributes', '').camelize
47
+ name.to_s.
48
+ gsub('s_attributes', '').
49
+ gsub('_attributes', '').
50
+ camelize
48
51
  end
49
52
  end
50
53
 
@@ -1,3 +1,3 @@
1
1
  module StrongArms
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/rubocop.yml CHANGED
@@ -1,11 +1,6 @@
1
1
  AllCops:
2
2
  Exclude:
3
3
  - db/schema.rb
4
- - db/migrate/*
5
- - Gemfile*
6
- - config/*
7
- - node_modules/**/*
8
- - vendor/**/*
9
4
 
10
5
  Naming/AccessorMethodName:
11
6
  Description: Check the naming of accessor methods for get_/set_.
@@ -157,7 +152,7 @@ Style/FrozenStringLiteralComment:
157
152
  to help transition from Ruby 2.3.0 to Ruby 3.0.
158
153
  Enabled: false
159
154
 
160
- Style/FlipFlop:
155
+ Lint/FlipFlop:
161
156
  Description: 'Checks for flip flops'
162
157
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
163
158
  Enabled: false
@@ -314,6 +309,13 @@ Style/RegexpLiteral:
314
309
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
315
310
  Enabled: false
316
311
 
312
+ Style/Sample:
313
+ Description: >-
314
+ Use `sample` instead of `shuffle.first`,
315
+ `shuffle.last`, and `shuffle[Fixnum]`.
316
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
317
+ Enabled: false
318
+
317
319
  Style/SelfAssignment:
318
320
  Description: >-
319
321
  Checks for places where self-assignment shorthand should have
@@ -345,7 +347,7 @@ Style/StringLiterals:
345
347
  Description: 'Checks if uses of quotes match the configured preference.'
346
348
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
347
349
  EnforcedStyle: double_quotes
348
- Enabled: false
350
+ Enabled: true
349
351
 
350
352
  Style/TrailingCommaInArguments:
351
353
  Description: 'Checks for trailing comma in argument lists.'
@@ -584,13 +586,6 @@ Performance/ReverseEach:
584
586
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
585
587
  Enabled: false
586
588
 
587
- Performance/Sample:
588
- Description: >-
589
- Use `sample` instead of `shuffle.first`,
590
- `shuffle.last`, and `shuffle[Fixnum]`.
591
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
592
- Enabled: false
593
-
594
589
  Performance/Size:
595
590
  Description: >-
596
591
  Use `size` instead of `count` for counting
@@ -652,4 +647,4 @@ Rails/TimeZone:
652
647
 
653
648
  Rails/Validation:
654
649
  Description: 'Use validates :attribute, hash of validations.'
655
- Enabled: false
650
+ Enabled: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strong_arms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mrjonesbot
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-12 00:00:00.000000000 Z
11
+ date: 2019-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,7 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
- rubygems_version: 3.0.3
128
+ rubyforge_project:
129
+ rubygems_version: 2.7.6.2
129
130
  signing_key:
130
131
  specification_version: 4
131
132
  summary: Strong Parameters alternative for Ruby/Rails applications