Class: Gollum::Git::Tree

Inherits:
Object
  • Object
show all
Defined in:
lib/grit_adapter/git_layer_grit.rb

Instance Method Summary collapse

Constructor Details

#initialize(tree) ⇒ Tree

Returns a new instance of Tree.


362
363
364
# File 'lib/grit_adapter/git_layer_grit.rb', line 362

def initialize(tree)
  @tree = tree
end

Instance Method Details

#/(file) ⇒ Object

if index.current_tree && tree = index.current_tree / (@wiki.page_file_dir || '/')


379
380
381
382
383
384
385
386
387
388
389
# File 'lib/grit_adapter/git_layer_grit.rb', line 379

def /(file)
  result = @tree.send(:/, file)
  case result
  when Grit::Blob
    return Gollum::Git::Blob.new(result)
  when Grit::Tree
    return Gollum::Git::Tree.new(result)
  else
    nil
  end
end

#[](i) ⇒ Object


370
371
372
# File 'lib/grit_adapter/git_layer_grit.rb', line 370

def [](i)
  @tree[i]
end

#blobsObject


391
392
393
394
# File 'lib/grit_adapter/git_layer_grit.rb', line 391

def blobs
  return Array.new if @tree == {}
  @tree.blobs.map{|blob| Gollum::Git::Blob.new(blob) }
end

#idObject


374
375
376
# File 'lib/grit_adapter/git_layer_grit.rb', line 374

def id
  @tree.id
end

#keysObject


366
367
368
# File 'lib/grit_adapter/git_layer_grit.rb', line 366

def keys
  @tree.keys
end