Class: Card

Inherits:
Cardio::Record show all
Extended by:
Cache::CardClass, Director::CardClass, Dirty::MethodFactory, Fetch::CardClass, Mark, Name::CardClass, Query::CardClass
Includes:
Cache::All, Content::All, Director::All, Dirty, DirtyNames, Fetch::All, Name::All, Reference::All, Rule::All, Set::CardMethods, Subcards::All
Defined in:
lib/card.rb,
lib/card/env.rb,
lib/card/set.rb,
lib/card/auth.rb,
lib/card/mark.rb,
lib/card/name.rb,
lib/card/rule.rb,
lib/card/view.rb,
lib/card/cache.rb,
lib/card/dirty.rb,
lib/card/error.rb,
lib/card/fetch.rb,
lib/card/query.rb,
lib/card/format.rb,
lib/card/mailer.rb,
lib/card/content.rb,
lib/card/lexicon.rb,
lib/card/setting.rb,
lib/card/codename.rb,
lib/card/director.rb,
lib/card/name/all.rb,
lib/card/rule/all.rb,
lib/card/set/type.rb,
lib/card/subcards.rb,
lib/card/cache/all.rb,
lib/card/fetch/all.rb,
lib/card/reference.rb,
lib/card/set/event.rb,
lib/card/set/trait.rb,
lib/card/auth/proxy.rb,
lib/card/auth/setup.rb,
lib/card/auth/token.rb,
lib/card/query/join.rb,
lib/card/rule/cache.rb,
lib/card/set/format.rb,
lib/card/view/cache.rb,
lib/card/content/all.rb,
lib/card/env/success.rb,
lib/card/env/support.rb,
lib/card/fetch/store.rb,
lib/card/format/nest.rb,
lib/card/query/value.rb,
lib/card/set/helpers.rb,
lib/card/set/pattern.rb,
lib/card/view/classy.rb,
lib/card/auth/current.rb,
lib/card/cache/shared.rb,
lib/card/content/diff.rb,
lib/card/director/all.rb,
lib/card/director/run.rb,
lib/card/env/location.rb,
lib/card/format/error.rb,
lib/card/query/clause.rb,
lib/card/set/abstract.rb,
lib/card/subcards/add.rb,
lib/card/subcards/all.rb,
lib/card/view/options.rb,
lib/card/content/chunk.rb,
lib/card/content/clean.rb,
lib/card/fetch/results.rb,
lib/card/format/render.rb,
lib/card/reference/all.rb,
lib/card/set/event/all.rb,
lib/card/set/registrar.rb,
lib/card/subcards/args.rb,
lib/card/cache/populate.rb,
lib/card/content/parser.rb,
lib/card/director/store.rb,
lib/card/fetch/retrieve.rb,
lib/card/format/content.rb,
lib/card/format/nesting.rb,
lib/card/format/wrapper.rb,
lib/card/name/all/parts.rb,
lib/card/set/i18n_scope.rb,
lib/card/cache/temporary.rb,
lib/card/director/phases.rb,
lib/card/director/stages.rb,
lib/card/name/card_class.rb,
lib/card/query/act_query.rb,
lib/card/set/inheritance.rb,
lib/card/set/pattern/all.rb,
lib/card/subcards/relate.rb,
lib/card/subcards/remove.rb,
lib/card/view/cache/stub.rb,
lib/card/view/permission.rb,
lib/card/auth/permissions.rb,
lib/card/cache/card_class.rb,
lib/card/env/serializable.rb,
lib/card/env/slot_options.rb,
lib/card/fetch/card_class.rb,
lib/card/query/card_class.rb,
lib/card/query/card_query.rb,
lib/card/set/advanced_api.rb,
lib/card/set/card_methods.rb,
lib/card/set/i18n_scanner.rb,
lib/card/set/pattern/base.rb,
lib/card/env/serialization.rb,
lib/card/format/nest/fetch.rb,
lib/card/model/save_helper.rb,
lib/card/set/event/options.rb,
lib/card/cache/shared_class.rb,
lib/card/content/diff/l_c_s.rb,
lib/card/env/success/target.rb,
lib/card/name/name_variants.rb,
lib/card/query/action_query.rb,
lib/card/set/required_field.rb,
lib/card/cache/class_methods.rb,
lib/card/content/diff/result.rb,
lib/card/director/card_class.rb,
lib/card/format/nesting/main.rb,
lib/card/format/nesting/mode.rb,
lib/card/format/registration.rb,
lib/card/query/sql_statement.rb,
lib/card/set/event/callbacks.rb,
lib/card/content/diff/summary.rb,
lib/card/director/event_delay.rb,
lib/card/dirty/method_factory.rb,
lib/card/env/location_history.rb,
lib/card/format/context_names.rb,
lib/card/name/all/descendants.rb,
lib/card/query/abstract_query.rb,
lib/card/query/card_query/run.rb,
lib/card/rule/read_rule_cache.rb,
lib/card/view/options/voo_api.rb,
lib/card/query/reference_query.rb,
lib/card/rule/preference_cache.rb,
lib/card/set/format/haml_paths.rb,
lib/card/content/chunk/abstract.rb,
lib/card/director/class_methods.rb,
lib/card/view/options/key_lists.rb,
lib/card/format/card_action_view.rb,
lib/card/query/card_query/custom.rb,
lib/card/query/value/match_value.rb,
lib/card/set/event/delayed_event.rb,
lib/card/view/cache/cache_action.rb,
lib/card/view/options/visibility.rb,
lib/card/format/method_delegation.rb,
lib/card/format/nesting/subformat.rb,
lib/card/query/abstract_query/tie.rb,
lib/card/query/card_query/sorting.rb,
lib/card/query/card_query/found_by.rb,
lib/card/query/sql_statement/joins.rb,
lib/card/query/sql_statement/order.rb,
lib/card/query/sql_statement/where.rb,
lib/card/set/pattern/class_methods.rb,
lib/card/director/subdirector_array.rb,
lib/card/set/event/skip_and_trigger.rb,
lib/card/set/format/abstract_format.rb,
lib/card/content/diff/l_c_s/processor.rb,
lib/card/query/card_query/conjunctions.rb,
lib/card/query/card_query/normalization.rb,
lib/card/query/card_query/interpretation.rb,
lib/card/model/save_helper/save_arguments.rb,
lib/card/query/abstract_query/query_helper.rb,
lib/card/query/card_query/match_attributes.rb,
lib/card/set/format/abstract_format/wrapper.rb,
lib/card/model/save_helper/save_helper_helper.rb,
lib/card/set/format/abstract_format/view_opts.rb,
lib/card/query/card_query/reference_attributes.rb,
lib/card/set/format/abstract_format/haml_views.rb,
lib/card/query/card_query/relational_attributes.rb,
lib/card/set/format/abstract_format/view_definition.rb

Overview

codename retrieval methods for cards

Defined Under Namespace

Modules: Auth, Dirty, DirtyNames, Env, Lexicon, Mark, Model, Query, Rule, Set, Setting Classes: Cache, Codename, Content, Director, Error, Fetch, Format, Mailer, Name, Reference, Subcards, View

Constant Summary

Constants included from Reference::All

Reference::All::PARTIAL_REF_CODE

Instance Attribute Summary

Attributes included from Director::All

#director

Attributes included from Name::All

#supercard

Instance Method Summary collapse

Methods included from Mark

cardish, id_or_name

Methods included from Dirty::MethodFactory

define_dirty_methods

Methods included from Name::CardClass

generate_alternative_name, rename!, uniquify_name

Methods included from Cache::CardClass

after_write_to_temp_cache, cache, expire, retrieve_from_cache, retrieve_from_cache_by_id, retrieve_from_cache_by_key, write_to_cache, write_to_temp_cache

Methods included from Director::CardClass

create, create!, ensure, ensure!

Methods included from Fetch::CardClass

[], fetch, fetch_from_cast, fetch_name, fetch_type_id, id, quick_fetch, uri_fetch

Methods included from Query::CardClass

count_by_cql, find_each, find_in_batches, search

Methods included from Subcards::All

#drop_field, #drop_subcard, #field, #field?, #field_content, #handle_subcard_errors, #subcard, #subcard?, #subcard_content, #subcards, #subcards?

Methods included from Fetch::All

#fetch, #newish, #refresh

Methods included from Rule::All

#preference, #preference?, #preference_card, #preference_card_id, #rule, #rule?, #rule_card, #rule_card_id, #standard_rule?

Methods included from Reference::All

#create_references_out, #name_referers, #nestees, #nesters, #referees, #referees_from_references, #referer_cards_from_references, #referers, #swap_names, #update_references_out

Methods included from Director::All

#act, #act_card, #act_card?, #clear_action_specific_attributes, #identify_action, #prepare_for_phases, #restore_changes_information, #save, #save!, #save_if_needed, #save_if_needed!, #save_needed?, #update, #update!, #valid?

Methods included from Cache::All

#ensure_view_cache_key, #expire, #lex, #view_cache_clean?, #write_lexicon

Methods included from Set::Pattern::All

#concrete_patterns, #each_type_assigning_module_key, #in_set?, #include_module?, #patterns, #patterns?, #prep_modules_for_caching, #reset_patterns, #rule_lookup_keys, #safe_set_keys, #set_format_modules, #set_modules, #set_names

Methods included from Set::Event::All

#event_applies?, #schedule

Methods included from Set::Event::SkipAndTrigger

#skip=, #skip_event!, #skip_event?, #skip_event_in_action!, #skip_hash, #skip_in_action=, #trigger=, #trigger_event!, #trigger_event?, #trigger_event_in_action!, #trigger_hash, #trigger_in_action=

Methods included from Content::All

#blank_content?, #clear_drafts, #content, #content=, #content?, #content_object, #last_draft_content, #nests?, #refresh_content, #save_content_draft, #standard_content, #standardize_content, #structured_content

Methods included from Name::All

#[], #autoname, #key, #key=, #name, #name=, #update_subcard_names, #update_superleft

Methods included from Name::All::Descendants

#child_ids, #each_child, #each_descendant, #field_cards, #field_ids, #field_names

Methods included from Name::All::Parts

#left, #left_id=, #left_or_new, #right, #right_id=, #tag, #trunk

Methods included from DirtyNames

#dirty_name, #lex_before_act, #name_before_act, #name_is_changing?

Methods included from Dirty

#attribute_before_act, #attribute_is_changing?, dirty_aliases, dirty_fields, dirty_options, #not_in_callback?

Instance Method Details

#codenameSymbol

Returns:

  • (Symbol)


6
7
8
# File 'lib/card/codename.rb', line 6

def codename
  super&.to_sym
end

#codename?True/False

Returns:

  • (True/False)


11
12
13
# File 'lib/card/codename.rb', line 11

def codename?
  codename.present?
end

#deserialize_for_active_job!(attr) ⇒ Object



86
87
88
89
90
91
# File 'lib/card/set/event/delayed_event.rb', line 86

def deserialize_for_active_job! attr
  attr.each do |attname, val|
    instance_variable_set("@#{attname}", val)
  end
  include_set_modules
end

#log_event_call(event) ⇒ Object



174
175
176
177
178
# File 'lib/card/set/event.rb', line 174

def log_event_call event
  Rails.logger.debug "#{name}: #{event}"
  # puts "#{name}: #{event}"
  # puts "#{Card::Director.to_s}".green
end

#rescuing_if_integration(is_integration, &block) ⇒ Object



163
164
165
# File 'lib/card/set/event.rb', line 163

def rescuing_if_integration is_integration, &block
  is_integration ? rescuing_integration(&block) : yield
end

#rescuing_integrationObject

one failed integration event should not harm others.



168
169
170
171
172
# File 'lib/card/set/event.rb', line 168

def rescuing_integration
  Error.rescue_card(self) { yield }
ensure
  true
end

#serializable_attributesObject

attributes that ActiveJob can handle

supercard and superleft are excluded, because it caused issues to have them in delayed job but not fully restored (set modules not included, attributes not retained, etc.) Since we’re supposed to have an actual left by the integrate_with_delay stage, it’s not clear that they’re needed. But if we revisit and find they are needed, then we clearly need to make sure that they are fully restored. At a bare minimum they would need to include set modules.



10
11
12
13
# File 'lib/card/set/event/delayed_event.rb', line 10

def serializable_attributes
  self.class.action_specific_attributes + set_specific.keys -
    %i[supercard superleft subcards]
end