Class: Suture::Comparator
- Inherits:
-
Object
- Object
- Suture::Comparator
- Defined in:
- lib/suture/comparator.rb
Constant Summary collapse
- DEFAULT_ACTIVE_RECORD_EXCLUDED_ATTRIBUTES =
[:updated_at, :created_at]
Instance Method Summary collapse
- #call(recorded, actual) ⇒ Object
-
#initialize(options = {}) ⇒ Comparator
constructor
A new instance of Comparator.
- #inspect ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Comparator
Returns a new instance of Comparator.
5 6 7 8 9 10 11 12 |
# File 'lib/suture/comparator.rb', line 5 def initialize( = {}) @options = { :active_record_excluded_attributes => ( [:active_record_excluded_attributes] || DEFAULT_ACTIVE_RECORD_EXCLUDED_ATTRIBUTES ).map(&:to_s) } end |
Instance Method Details
#call(recorded, actual) ⇒ Object
14 15 16 17 |
# File 'lib/suture/comparator.rb', line 14 def call(recorded, actual) is_equalivalent?(recorded, actual) || Marshal.dump(recorded) == Marshal.dump(actual) end |
#inspect ⇒ Object
19 20 21 |
# File 'lib/suture/comparator.rb', line 19 def inspect "#{self.class}.new(#{@options.inspect})" end |