Class: Gitt::Models::Trailer

Inherits:
Data
  • Object
show all
Defined in:
lib/gitt/models/trailer.rb

Overview

Represents commit trailer details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, value:, delimiter: ":", space: " ") ⇒ Trailer

Returns a new instance of Trailer.



9
10
11
# File 'lib/gitt/models/trailer.rb', line 9

def initialize key:, value:, delimiter: ":", space: " "
  super
end

Instance Attribute Details

#delimiterObject (readonly)

Returns the value of attribute delimiter

Returns:

  • (Object)

    the current value of delimiter



6
7
8
# File 'lib/gitt/models/trailer.rb', line 6

def delimiter
  @delimiter
end

#keyObject (readonly)

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



6
7
8
# File 'lib/gitt/models/trailer.rb', line 6

def key
  @key
end

#spaceObject (readonly)

Returns the value of attribute space

Returns:

  • (Object)

    the current value of space



6
7
8
# File 'lib/gitt/models/trailer.rb', line 6

def space
  @space
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



6
7
8
# File 'lib/gitt/models/trailer.rb', line 6

def value
  @value
end

Class Method Details

.for(string, parser: Parsers::Trailer.new) ⇒ Object



7
# File 'lib/gitt/models/trailer.rb', line 7

def self.for(string, parser: Parsers::Trailer.new) = parser.call string

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


13
# File 'lib/gitt/models/trailer.rb', line 13

def empty? = String(key).empty? || String(value).empty?

#to_sObject



15
# File 'lib/gitt/models/trailer.rb', line 15

def to_s = to_h.values.join