Module: CmpFS::Compare::CmpFS_Compare_Methods

Included in:
CmpFS::Compare, CmpFS::Compare
Defined in:
lib/cmpfs/compare/api_2.rb,
lib/cmpfs/compare/api_1_9.rb

Instance Method Summary collapse

Instance Method Details

#compare_binary(lhs, rhs, options = {}) ⇒ Object

Compares two files/streams in a binary (exact) manner

Signature

Return

true if the files/streams have exactly the same content; false otherwise.



38
39
40
41
# File 'lib/cmpfs/compare/api_2.rb', line 38

def compare_binary lhs, rhs, **options

  ::CmpFS::Compare::Binary::Internal_.compare_binary_ lhs, rhs, options
end

#compare_binary_files(lhs_path, rhs_path, options = {}) ⇒ Object

Compares two files, named by lhs_path and rhs_path, in a binary (exact) manner



18
19
20
21
# File 'lib/cmpfs/compare/api_2.rb', line 18

def compare_binary_files lhs_path, rhs_path, **options

  ::CmpFS::Compare::Binary::Internal_.compare_binary_files_ lhs_path, rhs_path, options
end

#compare_binary_streams(lhs_stm, rhs_stm, options = {}) ⇒ Object

Compares two streams, lhs_stm and rhs_stm, in a binary (exact) manner



25
26
27
28
# File 'lib/cmpfs/compare/api_2.rb', line 25

def compare_binary_streams lhs_stm, rhs_stm, **options

  ::CmpFS::Compare::Binary::Internal_.compare_binary_streams_ lhs_stm, rhs_stm, options
end

#compare_text(lhs, rhs, options = {}) ⇒ Object

Compares two files/streams, named by lhs and rhs, in a textual manner according to the given options

Signature

  • Parameters:

    • lhs

      (String, stream) The name of a file, or a stream object

    • rhs

      (String, stream) The name of a file, or a stream object

    • options

      (Hash) Options

  • Options:

    • :no_rewind

      (boolean) Prevents the default behaviour of

      rewinding the stream before processing
      
    • :skip_blank_lines

      (boolean) Determines whether blank lines

      should be skipped from the comparison
      
    • :trim_lines

      (boolean) Determines whether lines should be

      trimmed of leading and trailing space (including EOL sequence)
      

Return

true if the files/streams have exactly the same content; false otherwise.



118
119
120
121
# File 'lib/cmpfs/compare/api_2.rb', line 118

def compare_text lhs, rhs, **options

  ::CmpFS::Compare::Text::Internal_.compare_text_ lhs, rhs, options
end

#compare_text_files(lhs_path, rhs_path, options = {}) ⇒ Object

Compares two files, named by lhs_path and rhs_path, in a textual manner according to the given options

Signature

  • Parameters:

    • lhs_path

      (String) The name of a file

    • rhs_path

      (String) The name of a file

    • options

      (Hash) Options

  • Options:

    • :skip_blank_lines

      (boolean) Determines whether blank lines

      should be skipped from the comparison
      
    • :trim_lines

      (boolean) Determines whether lines should be

      trimmed of leading and trailing space (including EOL sequence)
      

Return

true if the files/streams have exactly the same content; false otherwise.



64
65
66
67
# File 'lib/cmpfs/compare/api_2.rb', line 64

def compare_text_files lhs_path, rhs_path, **options

  ::CmpFS::Compare::Text::Internal_.compare_text_files_ lhs_path, rhs_path, options
end

#compare_text_streams(lhs_stm, rhs_stm, options = {}) ⇒ Object

Compares two streams, named by lhs_stm and rhs_stm, in a textual manner according to the given options

Signature

  • Parameters:

    • lhs_stm

      (stream) A stream object

    • rhs_stm

      (stream) A stream object

    • options

      (Hash) Options

  • Options:

    • :no_rewind

      (boolean) Prevents the default behaviour of

      rewinding the stream before processing
      
    • :skip_blank_lines

      (boolean) Determines whether blank lines

      should be skipped from the comparison
      
    • :trim_lines

      (boolean) Determines whether lines should be

      trimmed of leading and trailing space (including EOL sequence)
      

Return

true if the files/streams have exactly the same content; false otherwise.



91
92
93
94
# File 'lib/cmpfs/compare/api_2.rb', line 91

def compare_text_streams lhs_stm, rhs_stm, **options

  ::CmpFS::Compare::Text::Internal_.compare_text_streams_ lhs_stm, rhs_stm, options
end