Sha256: 0de5d61f5c366ecc6bfe53d16e5f26ff0e5e997399bbb6b3b7aceb66fb0d009b

Contents?: true

Size: 357 Bytes

Versions: 2

Compression:

Stored size: 357 Bytes

Contents

require 'delegate'

module SubDiff
  class Diff < SimpleDelegator
    attr_reader :value_was

    alias_method :value, :__getobj__

    def initialize(value, value_was = nil)
      @value_was = value_was || value
      super(value)
    end

    def changed?
      value != value_was
    end

    def empty?
      value.empty? && !changed?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sub_diff-1.0.1 lib/sub_diff/diff.rb
sub_diff-1.0.0 lib/sub_diff/diff.rb