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

Extended by:
Card::Set
Defined in:
tmpsets/set/mod005-04_settings/right/structure.rb

Instance Method Summary collapse

Methods included from Card::Set

abstract_set?, all_set?, clean_empty_module_from_hash, clean_empty_modules, define_on_format, each_format, ensure_set, extended, format, include_set, include_set_formats, process_base_module_list, process_base_modules, register_set, register_set_format, shortname, stage_method, view, write_tmp_file

Methods included from Trait

#card_accessor, #card_reader, #card_writer

Methods included from Event

#define_event, #event

Instance Method Details

#structuree_namesObject



29
30
31
32
33
34
35
36
37
# File 'tmpsets/set/mod005-04_settings/right/structure.rb', line 29

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

#structuree_statementObject



55
56
57
58
59
# File 'tmpsets/set/mod005-04_settings/right/structure.rb', line 55

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

#update_structurees(args) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'tmpsets/set/mod005-04_settings/right/structure.rb', line 39

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