Class: Herb::DiffOperation

Inherits:
Data
  • Object
show all
Defined in:
lib/herb/diff_operation.rb,
lib/herb/diff_operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#new_indexObject (readonly)

Returns the value of attribute new_index

Returns:

  • (Object)

    the current value of new_index



5
6
7
# File 'lib/herb/diff_operation.rb', line 5

def new_index
  @new_index
end

#new_nodeObject (readonly)

Returns the value of attribute new_node

Returns:

  • (Object)

    the current value of new_node



5
6
7
# File 'lib/herb/diff_operation.rb', line 5

def new_node
  @new_node
end

#old_indexObject (readonly)

Returns the value of attribute old_index

Returns:

  • (Object)

    the current value of old_index



5
6
7
# File 'lib/herb/diff_operation.rb', line 5

def old_index
  @old_index
end

#old_nodeObject (readonly)

Returns the value of attribute old_node

Returns:

  • (Object)

    the current value of old_node



5
6
7
# File 'lib/herb/diff_operation.rb', line 5

def old_node
  @old_node
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



5
6
7
# File 'lib/herb/diff_operation.rb', line 5

def path
  @path
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



5
6
7
# File 'lib/herb/diff_operation.rb', line 5

def type
  @type
end

Instance Method Details

#inspectObject

: () -> String



30
31
32
# File 'lib/herb/diff_operation.rb', line 30

def inspect
  "#<#{self.class.name} type=#{type} path=[#{path.join(", ")}]>"
end

#to_hashObject Also known as: to_h

: () -> Hash[Symbol, untyped]



16
17
18
19
20
21
22
23
24
25
# File 'lib/herb/diff_operation.rb', line 16

def to_hash
  {
    type: type,
    path: path,
    old_node: old_node,
    new_node: new_node,
    old_index: old_index,
    new_index: new_index,
  }
end