Class: Herb::DiffOperation

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

Instance Attribute Summary collapse

Class Method 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

Class Method Details

.members[ :type, :path, :old_node, :new_node, :old_index, :new_index ]

Returns:

  • ([ :type, :path, :old_node, :new_node, :old_index, :new_index ])


20
# File 'sig/herb/diff_operation.rbs', line 20

def self.members: () -> [ :type, :path, :old_node, :new_node, :old_index, :new_index ]

.new(type, path, old_node, new_node, old_index, new_index) ⇒ instance .new(type:, path:, old_node:, new_node:, old_index:, new_index:) ⇒ instance

Overloads:

  • .new(type, path, old_node, new_node, old_index, new_index) ⇒ instance

    Parameters:

    Returns:

    • (instance)
  • .new(type:, path:, old_node:, new_node:, old_index:, new_index:) ⇒ instance

    Parameters:

    Returns:

    • (instance)


17
18
# File 'sig/herb/diff_operation.rbs', line 17

def self.new: (Symbol type, Array[Integer] path, Herb::AST::Node? old_node, Herb::AST::Node? new_node, Integer old_index, Integer new_index) -> instance
| (type: Symbol, path: Array[Integer], old_node: Herb::AST::Node?, new_node: Herb::AST::Node?, old_index: Integer, new_index: Integer) -> instance

Instance Method Details

#inspectString

: () -> String

Returns:

  • (String)


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

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

#members[ :type, :path, :old_node, :new_node, :old_index, :new_index ]

Returns:

  • ([ :type, :path, :old_node, :new_node, :old_index, :new_index ])


22
# File 'sig/herb/diff_operation.rbs', line 22

def members: () -> [ :type, :path, :old_node, :new_node, :old_index, :new_index ]

#to_hashHash[Symbol, untyped] Also known as: to_h

: () -> Hash[Symbol, untyped]

Returns:

  • (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