Class: Treeish::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/treeish/base.rb

Direct Known Subclasses

Branch, Tag

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(git: nil) ⇒ Base

Returns a new instance of Base.



10
11
12
# File 'lib/treeish/base.rb', line 10

def initialize(git: nil)
  @git = git || Git.open(Dir.pwd)
end

Instance Attribute Details

#gitObject (readonly)

Returns the value of attribute git.



8
9
10
# File 'lib/treeish/base.rb', line 8

def git
  @git
end

Instance Method Details

#recentsObject



14
15
16
17
18
19
20
21
22
# File 'lib/treeish/base.rb', line 14

def recents
  get_treeishes(recents_command) do |line, names|
    next if reject_strategy(line, names)
    names << {
      value: value_strategy(line, names),
      name: name_strategy(line, names)
    }
  end
end