Sha256: fc66e000fed0f778b12731d43105312828c0653f689ff9f872c6d6818cd14dce

Contents?: true

Size: 630 Bytes

Versions: 7

Compression:

Stored size: 630 Bytes

Contents

def state
  case
  when !known?     then :unknown
  when !ok?(:read) then :unknown # anti-fishing
  when real?       then :real
  when virtual?    then :virtual
  else :wtf
  end
end

def new_card?
  new_record? ||       # not yet in db (from ActiveRecord)
    !@from_trash.nil?  # in process of restoration from trash
end
alias_method :new?, :new_card?

def known?
  real? || virtual?
end

def real?
  !new_card?
end

def unknown?
  !known?
end

def pristine?
  # has not been edited directly by human users.  bleep blorp.
  new_card? || !actions.joins(:act).where(
    "card_acts.actor_id != ?", Card::WagnBotID
  ).exists?
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
card-1.91 mod/core/set/all/states.rb
card-1.21.0 mod/core/set/all/states.rb
card-1.20.4 mod/core/set/all/states.rb
card-1.20.3 mod/core/set/all/states.rb
card-1.20.2 mod/core/set/all/states.rb
card-1.20.1 mod/core/set/all/states.rb
card-1.20.0 mod/core/set/all/states.rb