module Archiveable
Constants
- VERSION
Public Instance Methods
archive()
click to toggle source
# File lib/archiveable.rb, line 29 def archive update archived: true end
archive!()
click to toggle source
# File lib/archiveable.rb, line 33 def archive! update! archived: true end
archived()
click to toggle source
# File lib/archiveable.rb, line 21 def archived archived_at.present? end
archived=(value)
click to toggle source
# File lib/archiveable.rb, line 25 def archived=(value) self.archived_at = bool(value) ? Time.now : nil end
publish()
click to toggle source
# File lib/archiveable.rb, line 37 def publish update archived: false end
publish!()
click to toggle source
# File lib/archiveable.rb, line 41 def publish! update! archived: false end
published()
click to toggle source
# File lib/archiveable.rb, line 13 def published !archived end
published=(value)
click to toggle source
# File lib/archiveable.rb, line 17 def published=(value) self.archived = !bool(value) end
Private Instance Methods
bool(value)
click to toggle source
# File lib/archiveable.rb, line 47 def bool(value) not ["false", "0", ""].include? value.to_s.downcase end