Sha256: 1f56d5eb283e330c3dc8092118d8d1686443b59640507a2fa5eeb18ad7a0fda9

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class All
# Set: All cards (Codename)
#
module Codename;
extend Card::Set
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/all/codename.rb"; end
def codename
  super&.to_sym
end

event :validate_codename, :validate, on: :update, changed: :codename do
  validate_codename_permission
  validate_codename_uniqueness
end

event :reset_codename_cache, :integrate, changed: :codename do
  return if action == :create && codename.nil?

  Card::Codename.reset_cache
  Card::Codename.generate_id_constants
end

private

def validate_codename_permission
  return if Auth.always_ok? || Auth.as_id == creator_id

  errors.add :codename, t(:core_only_admins_codename)
end

def validate_codename_uniqueness
  return (self.codename = nil) if codename.blank?
  return if errors.present? || !Card.find_by_codename(codename)

  errors.add :codename, t(:core_error_code_in_use, codename: codename)
end
end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card/mod/core/set/all/codename.rb ~~

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
card-1.101.7 tmpsets/set/mod002-core/all/codename.rb
card-1.101.6 tmpsets/set/mod002-core/all/codename.rb