Class: Rosette::Core::Ref

Inherits:
Object
  • Object
show all
Defined in:
lib/rosette/core/git/ref.rb

Direct Known Subclasses

Head, Remote, Tag

Constant Summary collapse

DELIMITER =
'/'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


37
38
39
# File 'lib/rosette/core/git/ref.rb', line 37

def name
  @name
end

Class Method Details

.inherited(subclass) ⇒ Object


18
19
20
# File 'lib/rosette/core/git/ref.rb', line 18

def inherited(subclass)
  descendants << subclass
end

.parse(ref_name) ⇒ Object


10
11
12
13
14
15
16
# File 'lib/rosette/core/git/ref.rb', line 10

def parse(ref_name)
  chunks = ref_name.split(DELIMITER)

  if chunks.first == 'refs'
    create_from(chunks[1..-1])
  end
end

Instance Method Details

#head?Boolean

Returns:

  • (Boolean)

43
44
45
# File 'lib/rosette/core/git/ref.rb', line 43

def head?
  type == :head
end

#remote?Boolean

Returns:

  • (Boolean)

39
40
41
# File 'lib/rosette/core/git/ref.rb', line 39

def remote?
  type == :remote
end

#tag?Boolean

Returns:

  • (Boolean)

47
48
49
# File 'lib/rosette/core/git/ref.rb', line 47

def tag?
  type == :tag
end