set/abstract/items.rb in card-mod-collection-0.13.4 vs set/abstract/items.rb in card-mod-collection-0.14.0

- old
+ new

@@ -74,11 +74,11 @@ # ~~~~~~~~~~~~ ALTERING ITEMS ~~~~~~~~~~~~ # set card content based on array and save card # @param array [Array] list of strings/names (Cardish) def items= array - items_to_content array + self.content = array save! end # append item to list (does not save) # @param cardish [Cardish] @@ -90,12 +90,11 @@ # @param cardish [String, Card::Name] item name # @param allow_duplicates [True/False] permit duplicate items (default is False) def add_item cardish, allow_duplicates=false return if !allow_duplicates && include_item?(cardish) - items = item_strings << cardish - items_to_content items + self.content = (item_strings << cardish) end # append item to list and save card # @param name [String, Card::Name] item name def add_item! name @@ -104,11 +103,11 @@ # remove item from list # @param cardish [String, Card::Name] item to drop def drop_item cardish drop_item_name = Card::Name[cardish] - items_to_content(item_names.reject { |item_name| item_name == drop_item_name }) + self.content = (item_names.reject { |item_name| item_name == drop_item_name }) end # remove item from list and save card # @param cardish [String, Card::Name] item to drop def drop_item! cardish @@ -121,11 +120,11 @@ # @param name [String, Card::Name] item name def insert_item index, name new_names = item_names new_names.delete name new_names.insert index, name - items_to_content new_names + self.content = new_names end # insert item into list at specified location and save # @param index [Integer] Array index in which to insert item (0 is first) # @param name [String, Card::Name] item name @@ -154,10 +153,10 @@ end # TODO: support type_code and type_id. (currently type) # uses name, because its most common use is from CQL def item_type - opt = options_rule_card + opt = options_card # FIXME: need better recursion prevention return if !opt || opt == self opt.item_type end