Sha256: 156e467c8fcbcfe90c1b4421b00b75ed6154b278b4a8c9dce428b2b95f418dc0

Contents?: true

Size: 337 Bytes

Versions: 7

Compression:

Stored size: 337 Bytes

Contents

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

7 entries across 7 versions & 1 rubygems

Version Path
sub_diff-1.1.0 lib/sub_diff/diff.rb
sub_diff-1.0.7 lib/sub_diff/diff.rb
sub_diff-1.0.6 lib/sub_diff/diff.rb
sub_diff-1.0.5 lib/sub_diff/diff.rb
sub_diff-1.0.4 lib/sub_diff/diff.rb
sub_diff-1.0.3 lib/sub_diff/diff.rb
sub_diff-1.0.2 lib/sub_diff/diff.rb