Module: Softie
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/softie.rb,
lib/softie/version.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- VERSION =
"1.0.0"
Instance Method Summary collapse
- #deleted(options = {}) ⇒ Object
- #deleted!(options = {}) ⇒ Object
- #deleted? ⇒ Boolean
- #restore ⇒ Object
- #restore! ⇒ Object
Instance Method Details
#deleted(options = {}) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/softie.rb', line 30 def deleted( = {}) public_send("#{[:key]}=", Time.now.utc) if [:deleted_by_class] public_send("#{[:deleted_by_key]}=", .delete(:by)) end end |
#deleted!(options = {}) ⇒ Object
38 39 40 41 |
# File 'lib/softie.rb', line 38 def deleted!( = {}) deleted() save end |
#deleted? ⇒ Boolean
56 57 58 |
# File 'lib/softie.rb', line 56 def deleted? public_send([:key]) != nil end |
#restore ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/softie.rb', line 43 def restore public_send("#{[:key]}=", nil) if [:deleted_by_class] public_send("#{[:deleted_by_key]}=", nil) end end |
#restore! ⇒ Object
51 52 53 54 |
# File 'lib/softie.rb', line 51 def restore! restore save end |