Class: FileScope

Inherits:
Machinery::Object show all
Defined in:
lib/file_scope.rb

Overview

Copyright © 2013-2015 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 Machinery::Object

#attributes, #scope

Instance Method Summary collapse

Methods inherited from Machinery::Object

#==, #[], #[]=, #as_json, convert_element, convert_raw_hash, #empty?, from_json, has_property, #hash, #initialize, #initialize_copy, #method_missing, #respond_to?, #set_attributes

Constructor Details

This class inherits a constructor from Machinery::Object

Dynamic Method Handling

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

Instance Method Details

#compare_with(other) ⇒ Object



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

def compare_with(other)
  validate_attributes(other)

  only_self = self.class.new
  only_other = self.class.new
  shared = self.class.new

  compare_extracted(other, only_self, only_other, shared)
  changed = compare_files(other, only_self, only_other, shared)

  only_self = nil if only_self.empty?
  only_other = nil if only_other.empty?
  shared = nil if shared.empty?
  [only_self, only_other, changed, shared]
end

#lengthObject



35
36
37
# File 'lib/file_scope.rb', line 35

def length
  files.try(:length) || 0
end