Class: Kamaze::Project::Tools::Git::Status::FilesArray Abstract

Inherits:
Array
  • Object
show all
Defined in:
lib/kamaze/project/tools/git/status/files_array.rb

Overview

This class is abstract.

Initialized using an Array representation of status

A memento is kept. Given files are filtered by type.

Direct Known Subclasses

Index, Worktree

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status) ⇒ FilesArray

Initialize using given status array representation

Parameters:

  • status (Array)


28
29
30
31
32
33
# File 'lib/kamaze/project/tools/git/status/files_array.rb', line 28

def initialize(status)
  super status.clone
              .keep_if { |file| file.public_send("#{self.class.type}?") }

  @memento = status.clone.map(&:freeze).freeze
end

Class Attribute Details

.typeSymbol (readonly)

Get type

Returns:

  • (Symbol)


22
23
24
# File 'lib/kamaze/project/tools/git/status/files_array.rb', line 22

def type
  @type
end

Instance Attribute Details

#mementoArray (readonly, protected)

Returns:

  • (Array)


38
39
40
# File 'lib/kamaze/project/tools/git/status/files_array.rb', line 38

def memento
  @memento
end