1 <?xml version=
"1.0" encoding=
"iso-8859-1"?>
3 PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
8 <title>Class: Git::Object
</title>
9 <meta http-equiv=
"Content-Type" content=
"text/html; charset=iso-8859-1" />
10 <meta http-equiv=
"Content-Script-Type" content=
"text/javascript" />
11 <link rel=
"stylesheet" href=
"../.././rdoc-style.css" type=
"text/css" media=
"screen" />
12 <script type=
"text/javascript">
15 function popupCode( url ) {
16 window.open(url,
"Code",
"resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
19 function toggleCode( id ) {
20 if ( document.getElementById )
21 elem = document.getElementById( id );
22 else if ( document.all )
23 elem = eval(
"document.all." + id );
27 elemStyle = elem.style;
29 if ( elemStyle.display !=
"block" ) {
30 elemStyle.display =
"block"
32 elemStyle.display =
"none"
38 // Make codeblocks hidden by default
39 document.writeln(
"<style type=\"text/css\
">div.method-source-code { display: none }</style>" )
49 <div id=
"classHeader">
50 <table class=
"header-table">
51 <tr class=
"top-aligned-row">
52 <td><strong>Class
</strong></td>
53 <td class=
"class-name-in-header">Git::Object
</td>
55 <tr class=
"top-aligned-row">
56 <td><strong>In:
</strong></td>
58 <a href=
"../../files/lib/git/object_rb.html">
65 <tr class=
"top-aligned-row">
66 <td><strong>Parent:
</strong></td>
68 <a href=
"Object.html">
75 <!-- banner header -->
77 <div id=
"bodyContent">
81 <div id=
"contextContent">
87 <div id=
"method-list">
88 <h3 class=
"section-bar">Methods
</h3>
90 <div class=
"name-list">
91 <a href=
"#M000122">new
</a>
102 <div id=
"class-list">
103 <h3 class=
"section-bar">Classes and Modules
</h3>
105 Class
<a href=
"Object/AbstractObject.html" class=
"link">Git::Object::AbstractObject
</a><br />
106 Class
<a href=
"Object/Blob.html" class=
"link">Git::Object::Blob
</a><br />
107 Class
<a href=
"Object/Commit.html" class=
"link">Git::Object::Commit
</a><br />
108 Class
<a href=
"Object/Tag.html" class=
"link">Git::Object::Tag
</a><br />
109 Class
<a href=
"Object/Tree.html" class=
"link">Git::Object::Tree
</a><br />
119 <!-- if method_list -->
121 <h3 class=
"section-bar">Public Class methods
</h3>
123 <div id=
"method-M000122" class=
"method-detail">
124 <a name=
"M000122"></a>
126 <div class=
"method-heading">
127 <a href=
"#M000122" class=
"method-signature">
128 <span class=
"method-name">new
</span><span class=
"method-args">(base, objectish, is_tag = false)
</span>
132 <div class=
"method-description">
134 if we
’re calling this, we don
’t know what type it is yet so
135 this is our little factory method
137 <p><a class=
"source-toggle" href=
"#"
138 onclick=
"toggleCode('M000122-source');return false;">[Source]
</a></p>
139 <div class=
"method-source-code" id=
"M000122-source">
141 <span class=
"ruby-comment cmt"># File lib/git/object.rb, line
87</span>
142 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">base
</span>,
<span class=
"ruby-identifier">objectish
</span>,
<span class=
"ruby-identifier">is_tag
</span> =
<span class=
"ruby-keyword kw">false
</span>)
143 <span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-identifier">is_tag
</span>
144 <span class=
"ruby-identifier">sha
</span> =
<span class=
"ruby-identifier">base
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">tag_sha
</span>(
<span class=
"ruby-identifier">objectish
</span>)
145 <span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-identifier">sha
</span> <span class=
"ruby-operator">==
</span> <span class=
"ruby-value str">''
</span>
146 <span class=
"ruby-identifier">raise
</span> <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">GitTagNameDoesNotExist
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">objectish
</span>)
147 <span class=
"ruby-keyword kw">end
</span>
148 <span class=
"ruby-keyword kw">return
</span> <span class=
"ruby-constant">Tag
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">base
</span>,
<span class=
"ruby-identifier">sha
</span>,
<span class=
"ruby-identifier">objectish
</span>)
149 <span class=
"ruby-keyword kw">else
</span>
150 <span class=
"ruby-identifier">sha
</span> =
<span class=
"ruby-identifier">base
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">revparse
</span>(
<span class=
"ruby-identifier">objectish
</span>)
151 <span class=
"ruby-identifier">type
</span> =
<span class=
"ruby-identifier">base
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">object_type
</span>(
<span class=
"ruby-identifier">sha
</span>)
152 <span class=
"ruby-keyword kw">end
</span>
154 <span class=
"ruby-identifier">klass
</span> =
155 <span class=
"ruby-keyword kw">case
</span> <span class=
"ruby-identifier">type
</span>
156 <span class=
"ruby-keyword kw">when
</span> <span class=
"ruby-regexp re">/blob/
</span><span class=
"ruby-operator">:
</span> <span class=
"ruby-constant">Blob
</span>
157 <span class=
"ruby-keyword kw">when
</span> <span class=
"ruby-regexp re">/commit/
</span><span class=
"ruby-operator">:
</span> <span class=
"ruby-constant">Commit
</span>
158 <span class=
"ruby-keyword kw">when
</span> <span class=
"ruby-regexp re">/tree/
</span><span class=
"ruby-operator">:
</span> <span class=
"ruby-constant">Tree
</span>
159 <span class=
"ruby-keyword kw">end
</span>
160 <span class=
"ruby-identifier">klass
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">base
</span>,
<span class=
"ruby-identifier">sha
</span>)
161 <span class=
"ruby-keyword kw">end
</span>
174 <div id=
"validator-badges">
175 <p><small><a href=
"http://validator.w3.org/check/referer">[Validate]
</a></small></p>