diff options
author | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-11-21 00:32:12 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-11-21 00:32:12 +0400 |
commit | 4bf4efe712489090fca4ce14be9cbe7637f4d511 (patch) | |
tree | ea094b51aa78c838b8c4cdc863ceeee208a93a89 /app/models/tree.rb | |
parent | 6721ef01f40221171671bea02f7c3477ad209c79 (diff) |
decorators & tree model
Diffstat (limited to 'app/models/tree.rb')
-rw-r--r-- | app/models/tree.rb | 24 |
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 |