snfoil-controller 1.1.2 → 1.1.3

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: 2756d2c30fd77f19885b0a4baf030cd16fb25d3536196d53823eb9d78b3a6fc2
4
- data.tar.gz: 16dfbd7e6f337ca9a2be5c25500e7b9ead7516e625d8813f7e5f0536bfab1e80
3
+ metadata.gz: 30037f7a35419e8de1da92218600be13dc1100f66038cd9c8e01a44bcea66581
4
+ data.tar.gz: 3a89ea36f71ec450eb20d37eed391fec23d7f836b13ad0226d2e2cc413358a4b
5
5
  SHA512:
6
- metadata.gz: c9544dd74cc0a37299b099b553c596d7d4f16ee4fbc838549ae598be43f2c4da5ff71f7fa3769ade2109b5598b38973e5a355492f00e8d4c3380b305c1ba1434
7
- data.tar.gz: b3bb46ff09c3066e4165c1c5ec748d9bca8d54e07750039fac510a8deb7d74dc7127dc93e3674d72cd77df7c015072589bc8c6b114e69549564e4798b2c384e3
6
+ metadata.gz: 102c59b528fe811eab77dfaa69d5061a37227575f2608a4cdbbb6949da59d646313265aec275c1cfe4ba80d68222554213438b25eac60c0e19254673bfa03750
7
+ data.tar.gz: 528df87e07ee5a48a61466c8d9dce0dca57af18fb9c128a381a3e5afe943fc887d56c231d123b599961448fba2fcf58233f1c1b0a929e080177f47b8a0dd536c
@@ -16,6 +16,6 @@
16
16
 
17
17
  module SnFoil
18
18
  module Controller
19
- VERSION = '1.1.2'
19
+ VERSION = '1.1.3'
20
20
  end
21
21
  end
@@ -46,7 +46,19 @@ module SnFoil
46
46
 
47
47
  def apply_transforms(output, input)
48
48
  (self.class.snfoil_attribute_transforms || {}).reduce(output) do |transformed_output, transform|
49
- apply_transform(transformed_output, input, transform[0], **transform[1])
49
+ transform_options = transform[1]
50
+ next transformed_output if transform_options[:if] && !check_conditional(transform_options[:if], input)
51
+ next transformed_output if transform_options[:unless] && check_conditional(transform_options[:unless], input)
52
+
53
+ apply_transform(transformed_output, input, transform[0], **transform_options)
54
+ end
55
+ end
56
+
57
+ def check_conditional(conditional, input)
58
+ if conditional.is_a? Symbol
59
+ send(conditional, input)
60
+ else
61
+ instance_exec(input, &conditional)
50
62
  end
51
63
  end
52
64
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snfoil-controller
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Howes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-01-30 00:00:00.000000000 Z
12
+ date: 2023-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport