Class: OsCtl::Image::Operations::File::Compare
- Includes:
- Lib::Utils::Log, Lib::Utils::System
- Defined in:
- lib/osctl/image/operations/file/compare.rb
Instance Attribute Summary collapse
- #files ⇒ Array readonly
Instance Method Summary collapse
-
#execute ⇒ Boolean
True if the files are same.
-
#initialize(file1, file2) ⇒ Compare
constructor
A new instance of Compare.
Methods inherited from Base
Constructor Details
#initialize(file1, file2) ⇒ Compare
Returns a new instance of Compare.
14 15 16 17 |
# File 'lib/osctl/image/operations/file/compare.rb', line 14 def initialize(file1, file2) super() @files = [file1, file2] end |
Instance Attribute Details
#files ⇒ Array (readonly)
10 11 12 |
# File 'lib/osctl/image/operations/file/compare.rb', line 10 def files @files end |
Instance Method Details
#execute ⇒ Boolean
Returns true if the files are same.
20 21 22 23 |
# File 'lib/osctl/image/operations/file/compare.rb', line 20 def execute ret = syscmd("cmp -s \"#{@files[0]}\" \"#{@files[1]}\"", valid_rcs: [1, 2]) ret.exitstatus == 0 end |