Class: Ghub::Models::Branch

Inherits:
Struct
  • Object
show all
Defined in:
lib/ghub/models/branch.rb

Overview

Defines a branch.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBranch

Returns a new instance of Branch.



16
17
18
19
# File 'lib/ghub/models/branch.rb', line 16

def initialize(**)
  super
  freeze
end

Instance Attribute Details

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



6
7
8
# File 'lib/ghub/models/branch.rb', line 6

def label
  @label
end

#refObject

Returns the value of attribute ref

Returns:

  • (Object)

    the current value of ref



6
7
8
# File 'lib/ghub/models/branch.rb', line 6

def ref
  @ref
end

#repoObject

Returns the value of attribute repo

Returns:

  • (Object)

    the current value of repo



6
7
8
# File 'lib/ghub/models/branch.rb', line 6

def repo
  @repo
end

#shaObject

Returns the value of attribute sha

Returns:

  • (Object)

    the current value of sha



6
7
8
# File 'lib/ghub/models/branch.rb', line 6

def sha
  @sha
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



6
7
8
# File 'lib/ghub/models/branch.rb', line 6

def user
  @user
end

Class Method Details

.for(**attributes) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/ghub/models/branch.rb', line 7

def self.for(**attributes)
  new(
    **attributes.merge!(
      user: User[**attributes[:user]],
      repo: Repository.for(**attributes[:repo])
    )
  )
end