Class: Odin::Types::DiffEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/odin/types/diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, value:, modifiers: nil) ⇒ DiffEntry

Returns a new instance of DiffEntry.



8
9
10
11
12
13
# File 'lib/odin/types/diff.rb', line 8

def initialize(path:, value:, modifiers: nil)
  @path = path.freeze
  @value = value
  @modifiers = modifiers
  freeze
end

Instance Attribute Details

#modifiersObject (readonly)

Returns the value of attribute modifiers.



6
7
8
# File 'lib/odin/types/diff.rb', line 6

def modifiers
  @modifiers
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/odin/types/diff.rb', line 6

def path
  @path
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/odin/types/diff.rb', line 6

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



15
16
17
18
# File 'lib/odin/types/diff.rb', line 15

def ==(other)
  other.is_a?(DiffEntry) && path == other.path &&
    value == other.value && modifiers == other.modifiers
end

#hashObject



21
22
23
# File 'lib/odin/types/diff.rb', line 21

def hash
  [path, value, modifiers].hash
end