Class: Machinery::FileScope

Inherits:
Array show all
Defined in:
lib/file_scope.rb

Overview

Copyright © 2013-2016 SUSE LLC

This program is free software; you can redistribute it and/or modify it under the terms of version 3 of the GNU General Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, contact SUSE LLC.

To contact SUSE about this file by physical or electronic mail, you may find current contact information at www.suse.com

Instance Attribute Summary

Attributes inherited from Array

#attributes, #elements, #scope

Instance Method Summary collapse

Methods inherited from Array

#&, #+, #-, #<<, #==, #as_json, #convert_element, #convert_raw_array, #empty?, from_json, has_attributes, has_elements, #hash, #initialize, #insert, #method_missing, #push, #respond_to?, #to_s

Constructor Details

This class inherits a constructor from Machinery::Array

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Machinery::Array

Instance Method Details

#compare_with(other) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/file_scope.rb', line 19

def compare_with(other)
  only_self, only_other, changed, common = super(other)

  if only_self && only_other
    changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
  end

  [
    only_self,
    only_other,
    changed,
    common
  ].map { |e| (e && !e.empty?) ? e : nil }
end