Module: Card::Set::All::Trash
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod003-core/all/trash.rb
Overview
Set: All cards (Trash)
Defined Under Namespace
Modules: ClassMethods
Constant Summary
Constants included from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Class Method Summary collapse
Instance Method Summary collapse
- #add_to_trash(args) {|args.merge trash: true| ... } ⇒ Object
- #db_attributes ⇒ Object
- #delete(args = {}) ⇒ Object
- #delete!(args = {}) ⇒ Object
- #delete_as_subcard(subcard) ⇒ Object
- #pull_from_trash! ⇒ Object
Methods included from Card::Set
Methods included from I18nScope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#method_missing, #num_set_parts, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscore
Methods included from Card::Set::AdvancedApi
#attachment, #ensure_set, #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 Basket
#abstract_basket, #add_to_basket, #basket, #unshift_basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
Class Method Details
.source_location ⇒ Object
7 |
# File 'tmpsets/set/mod003-core/all/trash.rb', line 7 def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/all/trash.rb"; end |
Instance Method Details
#add_to_trash(args) {|args.merge trash: true| ... } ⇒ Object
70 71 72 73 |
# File 'tmpsets/set/mod003-core/all/trash.rb', line 70 def add_to_trash args return if new_card? yield args.merge trash: true end |
#db_attributes ⇒ Object
94 95 96 |
# File 'tmpsets/set/mod003-core/all/trash.rb', line 94 def db_attributes send(:mutations_from_database).send :attributes end |
#delete(args = {}) ⇒ Object
58 59 60 61 62 |
# File 'tmpsets/set/mod003-core/all/trash.rb', line 58 def delete args={} add_to_trash args do |delete_args| update delete_args end end |
#delete!(args = {}) ⇒ Object
64 65 66 67 68 |
# File 'tmpsets/set/mod003-core/all/trash.rb', line 64 def delete! args={} add_to_trash args do |delete_args| update! delete_args end end |
#delete_as_subcard(subcard) ⇒ Object
130 131 132 133 |
# File 'tmpsets/set/mod003-core/all/trash.rb', line 130 def delete_as_subcard subcard subcard.trash = true add_subcard subcard end |
#pull_from_trash! ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'tmpsets/set/mod003-core/all/trash.rb', line 81 def pull_from_trash! return unless (trashed_card = Card.find_by_key_and_trash key, true) # fwiw, now we _could_ get card using fetch look_in_trash: true (not tried). self.id = trashed_card.id # following is needed so that #id_in_database returns existing card id # (and record is updated correctly) db_attributes["id"] = trashed_card.db_attributes["id"] @from_trash = true @new_record = false end |