Method: ContentData.remove_instances
- Defined in:
- lib/content_data/content_data.rb
.remove_instances(a, b) ⇒ Object
B - A : Remove instances of A content from B content data B and return the new content data. If all instances are removed then the content record itself will be removed e.g A db:
Content_1 ->
Instance_1
Instance_2
Content_2 ->
Instance_3
B db:
Content_1 ->
Instance_1
Instance_2
Content_2 ->
Instance_3
Instance_4
B-A db:
Content_2 ->
Instance_4
796 797 798 799 800 801 802 803 804 805 |
# File 'lib/content_data/content_data.rb', line 796 def self.remove_instances(a, b) return nil if b.nil? return ContentData.new(b) if a.nil? c = ContentData.new(b) # create new cloned content C from B # remove contents of A from newly cloned content A a.each_instance { |_, _, _, _, server, path| c.remove_instance(server, path) } c end |