Class: Gitrb::Blob

Inherits:
GitObject show all
Defined in:
lib/gitrb/blob.rb

Overview

This class stores the raw string data of a blob

Instance Attribute Summary collapse

Attributes inherited from GitObject

#id, #repository

Instance Method Summary collapse

Methods inherited from GitObject

factory, inherited, #object

Constructor Details

#initialize(options = {}) ⇒ Blob

Initialize a Blob



9
10
11
12
13
# File 'lib/gitrb/blob.rb', line 9

def initialize(options = {})
  super(options)
  @data = options[:data]
  @mode = options[:mode] || 0100644
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



6
7
8
# File 'lib/gitrb/blob.rb', line 6

def data
  @data
end

#modeObject

Returns the value of attribute mode.



6
7
8
# File 'lib/gitrb/blob.rb', line 6

def mode
  @mode
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/gitrb/blob.rb', line 19

def ==(other)
  Blob === other && id == other.id
end

#dumpObject



23
24
25
# File 'lib/gitrb/blob.rb', line 23

def dump
  @data
end

#saveObject

Save the data to the git object repository



28
29
30
31
# File 'lib/gitrb/blob.rb', line 28

def save
  repository.put(self)
  id
end

#typeObject



15
16
17
# File 'lib/gitrb/blob.rb', line 15

def type
  :blob
end