encrypted_form_fields 0.2.4 → 1.0.0

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
- SHA1:
3
- metadata.gz: 63aa6e017cfc401330ae6cdabbf2561b9e49ca9f
4
- data.tar.gz: d6522d42a8867a53e93304a8aec27523e6a0e7fa
2
+ SHA256:
3
+ metadata.gz: f8473fbe12c2e4651d59618721c3f558801973dc3bd7e310b7eebbbded6566a0
4
+ data.tar.gz: cdf26728c8324e54939455e804a79c97202c29532dfc4df365e4f4c40bcb0a96
5
5
  SHA512:
6
- metadata.gz: 6638b06b2d2c60988ad03881b6a0b8c26f7d3ab6f381f2d1a7e097f9778143d209bec7c5eb1a6f31cafa4efa76c2bf79a2a4bbec4cdb5b8b26e755841bc076d2
7
- data.tar.gz: ec4cdc27fbdea879503d7a4175dc377cdf9534275ec4d04bf1ccedd4202d366bb10aad03c1ebd91c50c4dc11b252824d927510319261468c75550c4181a96242
6
+ metadata.gz: 469720e80d0c1755bf03225fcccf35eea9861ca744d6a1750b203cb21315c2aa4c067ada1a72d5144795989bf1776713bcf55bad31a0e5d8d6433798085837c2
7
+ data.tar.gz: 1f512961dd5d7814964b87b92f29fcda7c1075ce60fbadb66e40af657945f3b9ca28c99f2ac2deba254bab92f2b66833946cf704c5bac3f77c78e9bad7c548dd
@@ -5,19 +5,24 @@ gemfile:
5
5
  - gemfiles/rails_4.2.gemfile
6
6
  - gemfiles/rails_5.0.gemfile
7
7
  - gemfiles/rails_5.1.gemfile
8
+ - gemfiles/rails_5.2.gemfile
8
9
  - Gemfile
10
+ before_install:
11
+ - gem update --system
12
+ - gem install bundler
9
13
  rvm:
10
- - '2.2.6'
11
- - '2.3.3'
12
- - '2.4.1'
13
- - jruby-9.1.8.0
14
+ - '2.2.10'
15
+ - '2.3.7'
16
+ - '2.4.4'
17
+ - '2.5.1'
18
+ - jruby-9.1.15.0
14
19
  matrix:
15
20
  include:
16
- - rvm: '2.3.3'
21
+ - rvm: '2.3.7'
17
22
  gemfile: 'gemfiles/rails_4.0.gemfile'
18
- - rvm: '2.3.3'
23
+ - rvm: '2.3.7'
19
24
  gemfile: 'gemfiles/rails_4.1.gemfile'
20
- - rvm: '2.4.1'
25
+ - rvm: '2.4.4'
21
26
  gemfile: gemfiles/rails_head.gemfile
22
27
  allow_failures:
23
28
  - gemfile: gemfiles/rails_head.gemfile
data/Appraisals CHANGED
@@ -18,6 +18,10 @@ appraise "rails-5.1" do
18
18
  gem 'rails', '~> 5.1.0'
19
19
  end
20
20
 
21
+ appraise "rails-5.2" do
22
+ gem 'rails', '~> 5.2.0'
23
+ end
24
+
21
25
  appraise "rails-head" do
22
26
  gem 'rails', github: 'rails'
23
27
  gem 'arel', github: 'rails/arel'
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 5.2.0"
6
+
7
+ gemspec path: "../"
@@ -4,16 +4,30 @@ require "action_view/helpers/tags/hidden_field"
4
4
  module EncryptedFormFields
5
5
  module Helpers
6
6
  class EncryptedField < ActionView::Helpers::Tags::HiddenField
7
+ class << self
8
+ def field_type
9
+ "hidden"
10
+ end
11
+ end
12
+
7
13
  def initialize(object_name, method_name, template_object, options = {})
8
14
  super(object_name, method_name, template_object, options.dup)
9
- value = @options.with_indifferent_access.fetch("value") { value_before_type_cast(object) }
15
+ value = @options.with_indifferent_access.fetch("value") do
16
+ encrypted_field_value_before_type_cast(object)
17
+ end
10
18
  @options["value"] = EncryptedFormFields.encrypt_and_sign(value)
11
19
  @object_name = EncryptedFormFields.prefix_name(@object_name)
12
20
  end
13
21
 
14
- class << self
15
- def field_type
16
- "hidden"
22
+ private
23
+
24
+
25
+ def encrypted_field_value_before_type_cast(object)
26
+ if method(:value_before_type_cast).arity.zero?
27
+ value_before_type_cast
28
+ else
29
+ # Fallbackf for Rails < 5.2
30
+ value_before_type_cast(object)
17
31
  end
18
32
  end
19
33
  end
@@ -1,3 +1,3 @@
1
1
  module EncryptedFormFields
2
- VERSION = "0.2.4".freeze
2
+ VERSION = "1.0.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: encrypted_form_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ville Lautanala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-04 00:00:00.000000000 Z
11
+ date: 2018-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -129,6 +129,7 @@ files:
129
129
  - gemfiles/rails_4.2.gemfile
130
130
  - gemfiles/rails_5.0.gemfile
131
131
  - gemfiles/rails_5.1.gemfile
132
+ - gemfiles/rails_5.2.gemfile
132
133
  - gemfiles/rails_head.gemfile
133
134
  - lib/encrypted_form_fields.rb
134
135
  - lib/encrypted_form_fields/dfs.rb
@@ -164,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  version: '0'
165
166
  requirements: []
166
167
  rubyforge_project:
167
- rubygems_version: 2.6.11
168
+ rubygems_version: 2.7.6
168
169
  signing_key:
169
170
  specification_version: 4
170
171
  summary: Encrypted form fields for Rails