Module: Card::Set::Abstract::VirtualCache

Extended by:
Card::Set
Defined in:
platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb

Overview

-- encoding : utf-8 --

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

Constants included from Event::Api

Event::Api::OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Card::Set

reset

Methods included from I18nScope

#mod_name, #scope

Methods included from Registrar

#extended, #finalize_load, #process_base_modules, #register_set

Methods included from Helpers

#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name

Methods included from Card::Set::AdvancedApi

#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #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 Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Class Method Details

.source_locationObject



8
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 8

def self.source_location; "/Users/ethan/dev/decko/gem/mod/virtual/set/abstract/virtual_cache.rb"; end

Instance Method Details

#db_contentObject



20
21
22
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 20

def db_content
  Virtual.fetch(self)&.content
end

#deleteObject



50
51
52
53
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 50

def delete
  # delete although it's new
  update trash: true
end

#delete!Object



55
56
57
58
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 55

def delete!
  # delete although it's new
  update! trash: true
end

#event: delete_virtual_contentObject



33
34
35
36
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 33

event :delete_virtual_content, :prepare_to_store, on: :delete do
  Virtual.delete self
  abort :success unless real?
end

#event: save_virtual_contentObject



28
29
30
31
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 28

event :save_virtual_content, :prepare_to_store, on: :save do
  Virtual.save self
  abort :success
end

#followable?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 46

def followable?
  false
end

#history?Boolean

TODO: confirm that the following are needed (and if so, explain why) in theory, if we always abort, we’ll never trigger history/follow events, and we’ll never have a card to delete, no?

Returns:

  • (Boolean)


42
43
44
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 42

def history?
  false
end

#updated_atObject



24
25
26
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 24

def updated_at
  Virtual.fetch(self)&.updated_at
end

#virtual?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 10

def virtual?
  new?
end

#virtual_contentObject

the content to be cached (can be overridden)



16
17
18
# File 'platypus/tmp/set/gem-defaults/mod017-virtual/abstract/virtual_cache.rb', line 16

def virtual_content
  attributes["db_content"]
end