gitlab-org--gitlab-foss/app/models/tree.rb

33 lines
539 B
Ruby
Raw Normal View History

2011-11-20 20:32:12 +00:00
class Tree
2012-04-20 22:26:22 +00:00
include Linguist::BlobHelper
2011-11-20 20:32:12 +00:00
attr_accessor :path, :tree, :project, :ref
delegate :contents,
:basename,
:name,
:data,
2011-11-21 06:16:10 +00:00
:mime_type,
:mode,
:size,
2011-11-20 20:32:12 +00:00
:text?,
:colorize,
:to => :tree
def initialize(raw_tree, project, ref = nil, path = nil)
@project, @ref, @path = project, ref, path,
@tree = if path
raw_tree / path
else
raw_tree
end
end
def is_blob?
tree.is_a?(Grit::Blob)
end
2011-11-22 12:50:47 +00:00
def empty?
data.blank?
end
2011-11-20 20:32:12 +00:00
end