Class: Card

Inherits:
ApplicationRecord show all
Extended by:
Dirty::MethodFactory, Mark, Name::All::ClassMethods
Includes:
Director::CardMethods, Dirty, DirtyNames, Name::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/version.rb,
lib/card/codename.rb,
lib/card/director.rb,
lib/card/name/all.rb,
lib/card/set/type.rb,
lib/card/subcards.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/basket.rb,
lib/card/set/format.rb,
lib/card/set/loader.rb,
lib/card/view/cache.rb,
lib/generators/card.rb,
lib/card/env/success.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/content/diff.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/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/set/code_nest.rb,
lib/card/subcards/args.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/query/act_query.rb,
lib/card/set/inheritance.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/persistent.rb,
lib/card/content/truncate.rb,
lib/card/env/slot_options.rb,
lib/card/query/card_query.rb,
lib/card/set/advanced_api.rb,
lib/card/set/i18n_scanner.rb,
lib/card/set/pattern/base.rb,
lib/card/cache/prepopulate.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/content/diff/l_c_s.rb,
lib/card/name/name_variants.rb,
lib/card/query/action_query.rb,
lib/card/set/required_field.rb,
lib/card/content/diff/result.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/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/director/card_methods.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/act_direction.rb,
lib/card/name/all/class_methods.rb,
lib/card/name/fields_and_traits.rb,
lib/card/view/options/key_lists.rb,
lib/card/env/request_assignments.rb,
lib/card/format/card_action_view.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/director/subdirector_array.rb,
lib/card/set/format/abstract_format.rb,
lib/card/content/diff/l_c_s/processor.rb,
lib/card/tasks/card/file_card_creator.rb,
lib/generators/card/mod/mod_generator.rb,
lib/generators/card/set/set_generator.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/generators/card/format/format_generator.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/tasks/card/file_card_creator/haml_card.rb,
lib/generators/card/template/template_generator.rb,
lib/card/tasks/card/file_card_creator/style_card.rb,
lib/card/tasks/card/file_card_creator/script_card.rb,
lib/generators/card/migration/migration_generator.rb,
lib/card/set/format/abstract_format/view_definition.rb,
lib/card/tasks/card/file_card_creator/output_helper.rb,
lib/card/tasks/card/file_card_creator/abstract_file_card.rb,
lib/card/tasks/card/file_card_creator/abstract_file_card/ruby_file.rb,
lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb,
lib/card/tasks/card/file_card_creator/abstract_file_card/migration_file.rb

Overview

require “card/content/diff/processor”

Defined Under Namespace

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

Constant Summary

Constants included from Mark

Mark::CODENAME_MARK_RE, Mark::ID_MARK_RE

Instance Attribute Summary

Attributes included from Director::CardMethods

#director

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Name::All::ClassMethods

rename!, uniquify_name

Methods included from Dirty::MethodFactory

define_dirty_methods

Methods included from Mark

bad_mark, cardish, id_from_mark, id_from_string, id_or_name, name_from_mark

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_ids, #field_names, #fields

Methods included from Name::All::Parts

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

Methods included from Director::CardMethods

#clear_action_specific_attributes, #identify_action, #prepare_for_phases, #restore_changes_information

Methods included from DirtyNames

#dirty_name, #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?

Class Method Details

.cacheObject


5
6
7
# File 'lib/card/cache.rb', line 5

def cache
  Card::Cache[Card]
end

Instance Method Details

#deserialize_for_active_job!(attr) ⇒ Object


79
80
81
82
83
84
# File 'lib/card/set/event/delayed_event.rb', line 79

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


172
173
174
175
176
# File 'lib/card/set/event.rb', line 172

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) ⇒ Object


159
160
161
# File 'lib/card/set/event.rb', line 159

def rescuing_if_integration is_integration
  is_integration ? rescuing_integration { yield } : yield
end

#rescuing_integrationObject

one failed integration event should not harm others.


164
165
166
167
168
169
170
# File 'lib/card/set/event.rb', line 164

def rescuing_integration
  yield
rescue StandardError => e
  Card::Error.report e, self
ensure
  true
end

#serializable_attributesObject

attributes that ActiveJob can handle


5
6
7
# File 'lib/card/set/event/delayed_event.rb', line 5

def serializable_attributes
  self.class.action_specific_attributes + set_specific.keys
end