Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-11-21 00:32:12 +0400
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-11-21 00:32:12 +0400
commit4bf4efe712489090fca4ce14be9cbe7637f4d511 (patch)
treeea094b51aa78c838b8c4cdc863ceeee208a93a89 /app/models/tree.rb
parent6721ef01f40221171671bea02f7c3477ad209c79 (diff)
decorators & tree model
Diffstat (limited to 'app/models/tree.rb')
-rw-r--r--app/models/tree.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/models/tree.rb b/app/models/tree.rb
new file mode 100644
index 00000000000..032290a0f46
--- /dev/null
+++ b/app/models/tree.rb
@@ -0,0 +1,24 @@
+class Tree
+ attr_accessor :path, :tree, :project, :ref
+
+ delegate :contents,
+ :basename,
+ :name,
+ :data,
+ :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
+end