Sha256: 9819cabe7eb081cde0f2ffbe52d5b2a6849d618053899c69c322365a370fddeb

Contents?: true

Size: 1.76 KB

Versions: 49

Compression:

Stored size: 1.76 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class Right; module Structure; extend Card::Set
# ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/settings/set/right/structure.rb ~~

format :rss do
  def raw_feed_items _args
    [card]
  end
end

format :html do
  include AddHelp::HtmlFormat
end

event :update_structurees_references, :integrate,
      when: proc { |c| c.db_content_changed? || c.action == :delete } do
  return unless (statement = structuree_statement)
  Auth.as_bot do
    Card::Query.run(statement).each(&:update_references_out)
  end
end

event :reset_cache_to_use_new_structure,
      before: :update_structurees_references do
  Card::Cache.reset_hard
  Card::Cache.reset_soft
end

event :update_structurees_type, :finalize,
      changed: :type_id, when: proc { |c| c.assigns_type? } do
  update_structurees type_id: type_id
end

def structuree_names
  if (wql = structuree_statement)
    Auth.as_bot do
      Card::Query.run wql.merge(return: :name)
    end
  else
    []
  end
end

def update_structurees args
  # note that this is not smart about overriding templating rules
  # for example, if someone were to change the type of a
  # +*right+*structure rule that was overridden
  # by a +*type plus right+*structure rule, the override would not be respected.

  statement = structuree_statement
  return unless statement
  Auth.as_bot do
    statement[:return] = :id
    Card::Query.run(statement).each_slice(100) do |id_batch|
      Card.where(id: id_batch).update_all args
    end
  end
end

def structuree_statement
  set_card = trunk
  return unless set_card.type_id == SetID
  set_card.get_query
end


# ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/settings/set/right/structure.rb ~~
end;end;end;end;

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
card-1.99.6 tmpsets/set/mod012-settings/right/structure.rb
card-1.99.5 tmpsets/set/mod012-settings/right/structure.rb
card-1.97.0.1 tmpsets/set/mod012-settings/right/structure.rb
card-1.97.0 tmpsets/set/mod012-settings/right/structure.rb
card-1.96.8 tmpsets/set/mod012-settings/right/structure.rb
card-1.96.7 tmpsets/set/mod012-settings/right/structure.rb
card-1.96.6 tmpsets/set/mod012-settings/right/structure.rb
card-1.96.5 tmpsets/set/mod012-settings/right/structure.rb
card-1.96.4 tmpsets/set/mod012-settings/right/structure.rb
card-1.96.3 tmpsets/set/mod012-settings/right/structure.rb
card-1.96.2 tmpsets/set/mod012-settings/right/structure.rb
card-1.96.1 tmpsets/set/mod012-settings/right/structure.rb
card-1.96.0 tmpsets/set/mod012-settings/right/structure.rb
card-1.95.3 tmpsets/set/mod012-settings/right/structure.rb
card-1.95.2 tmpsets/set/mod012-settings/right/structure.rb
card-1.95.1 tmpsets/set/mod012-settings/right/structure.rb
card-1.95.0 tmpsets/set/mod012-settings/right/structure.rb
card-1.94.1 tmpsets/set/mod012-settings/right/structure.rb
card-1.94.0 tmpsets/set/mod012-settings/right/structure.rb
card-1.93.13 tmpsets/set/mod012-settings/right/structure.rb