Class: Git::StashInfo

Inherits:
Data
  • Object
show all
Defined in:
lib/git/stash_info.rb

Overview

Immutable value object representing stash entry information

StashInfo encapsulates the parsed data from git stash list output. Each entry contains comprehensive information about the stash including its index, reference name, commit SHA, branch, message, author/committer details, and timestamps.

Examples:

Create a StashInfo from parsed stash list output

info = Git::StashInfo.new(
  index: 0,
  name: 'stash@{0}',
  oid: 'abc123def456789...',
  short_oid: 'abc123d',
  branch: 'main',
  message: 'WIP on main: abc123 Initial commit',
  author_name: 'Jane Doe',
  author_email: 'jane@example.com',
  author_date: '2026-01-24T10:30:00-08:00',
  committer_name: 'Jane Doe',
  committer_email: 'jane@example.com',
  committer_date: '2026-01-24T10:30:00-08:00'
)

info.index           # => 0
info.name            # => 'stash@{0}'
info.oid             # => 'abc123def456789...'
info.short_oid       # => 'abc123d'
info.branch          # => 'main'
info.message         # => 'WIP on main: abc123 Initial commit'
info.author_name     # => 'Jane Doe'
info.author_email    # => 'jane@example.com'
info.author_date     # => '2026-01-24T10:30:00-08:00'
info.committer_name  # => 'Jane Doe'
info.committer_email # => 'jane@example.com'
info.committer_date  # => '2026-01-24T10:30:00-08:00'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#author_dateObject (readonly)

Returns the value of attribute author_date

Returns:

  • (Object)

    the current value of author_date



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#author_emailObject (readonly)

Returns the value of attribute author_email

Returns:

  • (Object)

    the current value of author_email



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#author_nameObject (readonly)

Returns the value of attribute author_name

Returns:

  • (Object)

    the current value of author_name



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#branchObject (readonly)

Returns the value of attribute branch

Returns:

  • (Object)

    the current value of branch



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#committer_dateObject (readonly)

Returns the value of attribute committer_date

Returns:

  • (Object)

    the current value of committer_date



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#committer_emailObject (readonly)

Returns the value of attribute committer_email

Returns:

  • (Object)

    the current value of committer_email



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#committer_nameObject (readonly)

Returns the value of attribute committer_name

Returns:

  • (Object)

    the current value of committer_name



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#indexObject (readonly)

Returns the value of attribute index

Returns:

  • (Object)

    the current value of index



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#oidObject (readonly)

Returns the value of attribute oid

Returns:

  • (Object)

    the current value of oid



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

#short_oidObject (readonly)

Returns the value of attribute short_oid

Returns:

  • (Object)

    the current value of short_oid



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/git/stash_info.rb', line 79

StashInfo = Data.define(
  :index,
  :name,
  :oid,
  :short_oid,
  :branch,
  :message,
  :author_name,
  :author_email,
  :author_date,
  :committer_name,
  :committer_email,
  :committer_date
) do
  # Returns the stash reference name
  #
  # @return [String] the stash name (e.g., 'stash@\\{0}')
  #
  # @example
  #   info.to_s # => 'stash@{0}'
  #
  def to_s
    name
  end
end

Instance Method Details

#to_sString

Returns the stash reference name

Examples:

info.to_s # => 'stash@{0}'

Returns:

  • (String)

    the stash name (e.g., 'stash@{0}')



100
101
102
# File 'lib/git/stash_info.rb', line 100

def to_s
  name
end