Sha256: 08d76ba4fc49434332b8fa203b7189a799d30072393d307ad8119944678ff60b

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class All
# Set: All cards (Actify)
#
module Actify;
extend Card::Set
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/all/actify.rb"; end
def act options={}, &block
  if act_card
    add_to_act options, &block
  else
    start_new_act &block
  end
end

def act_card
  Card::Director.act_card
end

def act_card?
  self == act_card
end

module ClassMethods
  def create! opts
    card = Card.new opts
    card.save!
    card
  end

  def create opts
    card = Card.new opts
    card.save
    card
  end
end

def save! *args
  as_subcard = args.first&.delete :as_subcard
  act(as_subcard: as_subcard) { super }
end

def save(*)
  act { super }
end

def valid?(*)
  act(validating: true) { super }
end

def update *args
  act { super }
end

def update! *args
  act { super }
end

alias_method :update_attributes, :update
alias_method :update_attributes!, :update!

private

def start_new_act
  self.director = nil
  Director.run_act(self) do
    run_callbacks(:act) { yield }
  end
end

def add_to_act options={}
  director.appoint self unless @director
  director.head = true unless options[:validating] || options[:as_subcard]
  yield
end
end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card/mod/core/set/all/actify.rb ~~

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
card-1.101.5 tmpsets/set/mod002-core/all/actify.rb
card-1.101.4 tmpsets/set/mod002-core/all/actify.rb
card-1.101.3 tmpsets/set/mod002-core/all/actify.rb
card-1.101.2 tmpsets/set/mod002-core/all/actify.rb
card-1.101.1 tmpsets/set/mod002-core/all/actify.rb
card-1.101.0 tmpsets/set/mod002-core/all/actify.rb