confirmed_attributes 0.1.0 → 0.2.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
2
  SHA1:
3
- metadata.gz: 5ef3e6159580e4a642a25b585404cd6f18cff237
4
- data.tar.gz: f2d2d4db9414bf54ac1f2850c4419898964e1e4c
3
+ metadata.gz: 0c53f8b00c34c7e12875af6404aaded80bdf1cff
4
+ data.tar.gz: 14f15f40e0d82dd710ec2d59ed6667fac0b824d1
5
5
  SHA512:
6
- metadata.gz: fb5d1567f02b9aae8a086a25fc862ec37d4f055d431a45121b1a2b5d69527246ead7ecea1d7a2ef25e9b1ea937155262365bdad2a3e919c25fdd90bce0e41687
7
- data.tar.gz: d0a49b80a2cc833074600833df5a9038c154240edbf7aa4894c3855b2a1188f6513564c55d60d0ec667bab5eff703dda06031db4b8726f206c9ef9df053edefd
6
+ metadata.gz: 137a0001abfcab73a6dd371426b1515ee7754ec4be70e73ebbcf624341786c252942cfa05ea72945a05b57a3250401dfa1d508b18b041f5cc9bce6d171176485
7
+ data.tar.gz: b594be2970e1d06ed13e5bc3fe3df1d2a1e40164549ce4f146c1ef7045c16f867c37974a7efb577a8488079f589687efe30d6e0c567f3f08ccfe4b96960e6452
data/.gitignore CHANGED
@@ -1,10 +1,4 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
1
+ Gemfile.lock
10
2
  /dummy/
3
+ /pkg/
4
+ /bin/
data/README.md CHANGED
@@ -40,9 +40,11 @@ User.confirmable_attributes # => [:email]
40
40
  @user.confimed_attributes # => []
41
41
  @user.confirmed_attribute? :email # => false
42
42
 
43
- @user.confirm :email
43
+ @user.confirm :email # => true
44
44
  @user.confimed_attributes # => [#<ConfirmedAttributes::Control:0x007f2eacd2f730> name: "email", value: "your_mail"...]
45
45
  @user.confirmed_attribute? :email # => true
46
+
47
+ @user.unconfirm :email # => true
46
48
  ```
47
49
 
48
50
  Simple, yeah?
@@ -43,6 +43,13 @@ module ConfirmedAttributes
43
43
  confirmed_attribute.verify(attribute_name)
44
44
  end
45
45
 
46
+ def unconfirm(attribute_name, user_id = nil)
47
+ array = confirmed_attributes.where(name: attribute_name, value: send(attribute_name))
48
+ return false if new_record? || array.empty?
49
+
50
+ !!array.delete_all
51
+ end
52
+
46
53
  def confirmable_attribute?(attribute_name)
47
54
  return false if attribute_name.blank?
48
55
 
@@ -1,3 +1,3 @@
1
1
  module ConfirmedAttributes
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confirmed_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Shlinchak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-12 00:00:00.000000000 Z
11
+ date: 2015-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,8 +95,6 @@ files:
95
95
  - LICENSE.txt
96
96
  - README.md
97
97
  - Rakefile
98
- - bin/console
99
- - bin/setup
100
98
  - confirmed_attributes.gemspec
101
99
  - lib/confirmed_attributes.rb
102
100
  - lib/confirmed_attributes/confirmable.rb
@@ -129,3 +127,4 @@ signing_key:
129
127
  specification_version: 4
130
128
  summary: Confirmable attributes for ActiveRecord
131
129
  test_files: []
130
+ has_rdoc:
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "test_gem"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here