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

  • 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 that control the behaviour of the method

  • Options:

    • :no_rewind:: (boolean) Prevents the default behaviour of rewinding each stream before processing

Return

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



71
72
73
74
# File 'lib/cmpfs/compare/api_2.rb', line 71

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

Signature

  • Parameters:

    - lhs_path

    (+String+) The name of a file

    - rhs_path

    (+String+) The name of a file

    - options

    (+Hash+) Options that control the behaviour of the method

  • Options:

Return

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



31
32
33
34
# File 'lib/cmpfs/compare/api_2.rb', line 31

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

Signature

  • Parameters:

    - lhs_stm

    (stream) A stream object

    - rhs_stm

    (stream) A stream object

    - options

    (+Hash+) Options that control the behaviour of the method

  • Options:

    • :no_rewind:: (boolean) Prevents the default behaviour of rewinding each stream before processing

Return

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



51
52
53
54
# File 'lib/cmpfs/compare/api_2.rb', line 51

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, 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 that control the behaviour of the method

  • Options:

    • :no_rewind:: (boolean) Prevents the default behaviour of rewinding each 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 the same content; false otherwise.



137
138
139
140
# File 'lib/cmpfs/compare/api_2.rb', line 137

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 that control the behaviour of the method

  • 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 the same content; false otherwise.



93
94
95
96
# File 'lib/cmpfs/compare/api_2.rb', line 93

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, 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 that control the behaviour of the method

  • Options:

    • :no_rewind:: (boolean) Prevents the default behaviour of rewinding each 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 the same content; false otherwise.



115
116
117
118
# File 'lib/cmpfs/compare/api_2.rb', line 115

def compare_text_streams lhs_stm, rhs_stm, **options

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