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

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

Instance Method Summary collapse

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #pattern_and_modules_from_path, #process_base_modules, #register_set, #tmp_file_frame, #tmp_file_template, #tmp_file_wrapped_content, #write_tmp_file

Methods included from Helpers

#abstract_set?, #all_set?, #shortname

Methods included from AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#all_set_format_mod!, #define_on_format, #format, #register_set_format, #view

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer

Methods included from Event

#event

Instance Method Details

#structuree_namesObject



34
35
36
37
38
39
40
41
42
# File 'tmpsets/set/mod011-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/mod011-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/mod011-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