gitlabhq/app/models/tree.rb
Robert Speicher 7754189187 Fully embrace Ruby 1.9 hash syntax
Didn't bother with files in db/, config/, or features/
2012-08-10 18:25:15 -04:00

33 lines
536 B
Ruby

class Tree
include Linguist::BlobHelper
attr_accessor :path, :tree, :project, :ref
delegate :contents,
:basename,
:name,
:data,
:mime_type,
:mode,
:size,
: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
def empty?
data.blank?
end
end