Module: Card::Set::Right::Structure

Extended by:
Card::Set
Defined in:
tmpsets/set/mod012-settings/right/structure.rb

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

Instance Method Summary collapse

Methods included from Card::Set

reset_modules

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set

Methods included from Helpers

#method_missing, #num_set_parts, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscore

Methods included from AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket, #unshift_basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Instance Method Details

#structuree_namesObject



34
35
36
37
38
39
40
41
42
# File 'tmpsets/set/mod012-settings/right/structure.rb', line 34

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

#structuree_statementObject



60
61
62
63
64
# File 'tmpsets/set/mod012-settings/right/structure.rb', line 60

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

#update_structurees(args) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'tmpsets/set/mod012-settings/right/structure.rb', line 44

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