Class: Odin::Types::DiffMove

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_path:, to_path:, value:, modifiers: nil) ⇒ DiffMove

Returns a new instance of DiffMove.



53
54
55
56
57
58
59
# File 'lib/odin/types/diff.rb', line 53

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

Instance Attribute Details

#from_pathObject (readonly)

Returns the value of attribute from_path.



51
52
53
# File 'lib/odin/types/diff.rb', line 51

def from_path
  @from_path
end

#modifiersObject (readonly)

Returns the value of attribute modifiers.



51
52
53
# File 'lib/odin/types/diff.rb', line 51

def modifiers
  @modifiers
end

#to_pathObject (readonly)

Returns the value of attribute to_path.



51
52
53
# File 'lib/odin/types/diff.rb', line 51

def to_path
  @to_path
end

#valueObject (readonly)

Returns the value of attribute value.



51
52
53
# File 'lib/odin/types/diff.rb', line 51

def value
  @value
end

Instance Method Details

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



61
62
63
64
65
# File 'lib/odin/types/diff.rb', line 61

def ==(other)
  other.is_a?(DiffMove) && from_path == other.from_path &&
    to_path == other.to_path && value == other.value &&
    modifiers == other.modifiers
end

#hashObject



68
69
70
# File 'lib/odin/types/diff.rb', line 68

def hash
  [from_path, to_path, value, modifiers].hash
end