PageRenderTime 40ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/docs/gem.haml-3.1.4/classes/Haml.html

https://github.com/toy/rb
HTML | 278 lines | 185 code | 93 blank | 0 comment | 0 complexity | da29e3057943345662970d50d3b44d09 MD5 | raw file
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5. <head>
  6. <title>Haml</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
  9. <link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
  10. <script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
  11. <script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
  12. <script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
  13. </head>
  14. <body>
  15. <div class="banner">
  16. <h1>
  17. <span class="type">Module</span>
  18. Haml
  19. </h1>
  20. <ul class="files">
  21. <li><a href="../files/lib/haml/buffer_rb.html">lib/haml/buffer.rb</a></li>
  22. <li><a href="../files/lib/haml/compiler_rb.html">lib/haml/compiler.rb</a></li>
  23. <li><a href="../files/lib/haml/engine_rb.html">lib/haml/engine.rb</a></li>
  24. <li><a href="../files/lib/haml/error_rb.html">lib/haml/error.rb</a></li>
  25. <li><a href="../files/lib/haml/exec_rb.html">lib/haml/exec.rb</a></li>
  26. <li><a href="../files/lib/haml/filters_rb.html">lib/haml/filters.rb</a></li>
  27. <li><a href="../files/lib/haml/helpers/action_view_extensions_rb.html">lib/haml/helpers/action_view_extensions.rb</a></li>
  28. <li><a href="../files/lib/haml/helpers/xss_mods_rb.html">lib/haml/helpers/xss_mods.rb</a></li>
  29. <li><a href="../files/lib/haml/helpers_rb.html">lib/haml/helpers.rb</a></li>
  30. <li><a href="../files/lib/haml/html/erb_rb.html">lib/haml/html/erb.rb</a></li>
  31. <li><a href="../files/lib/haml/html_rb.html">lib/haml/html.rb</a></li>
  32. <li><a href="../files/lib/haml/parser_rb.html">lib/haml/parser.rb</a></li>
  33. <li><a href="../files/lib/haml/root_rb.html">lib/haml/root.rb</a></li>
  34. <li><a href="../files/lib/haml/shared_rb.html">lib/haml/shared.rb</a></li>
  35. <li><a href="../files/lib/haml/template/options_rb.html">lib/haml/template/options.rb</a></li>
  36. <li><a href="../files/lib/haml/template/plugin_rb.html">lib/haml/template/plugin.rb</a></li>
  37. <li><a href="../files/lib/haml/template_rb.html">lib/haml/template.rb</a></li>
  38. <li><a href="../files/lib/haml/version_rb.html">lib/haml/version.rb</a></li>
  39. <li><a href="../files/lib/haml/util_rb.html">lib/haml/util.rb</a></li>
  40. <li><a href="../files/lib/haml_rb.html">lib/haml.rb</a></li>
  41. </ul>
  42. </div>
  43. <div id="bodyContent">
  44. <div id="content">
  45. <div class="description">
  46. <p>
  47. We keep options in its own self-contained file so that we can load it
  48. independently in Rails 3, where the full template stuff is lazy-loaded.
  49. </p>
  50. <hr size="1"></hr><p>
  51. This file makes <a href="Haml.html">Haml</a> work with Rails using the >
  52. 2.0.1 template handler API.
  53. </p>
  54. <hr size="1"></hr><p>
  55. The module that contains everything Haml-related:
  56. </p>
  57. <ul>
  58. <li>{Haml::Engine} is the class used to render <a href="Haml.html">Haml</a>
  59. within Ruby code.
  60. </li>
  61. <li>{Haml::Helpers} contains Ruby helpers available within <a
  62. href="Haml.html">Haml</a> templates.
  63. </li>
  64. <li>{Haml::Template} interfaces with web frameworks (Rails in particular).
  65. </li>
  66. <li>{Haml::Error} is raised when <a href="Haml.html">Haml</a> encounters an
  67. error.
  68. </li>
  69. <li>{Haml::HTML} handles conversion of <a href="Haml/HTML.html">HTML</a> to <a
  70. href="Haml.html">Haml</a>.
  71. </li>
  72. </ul>
  73. <p>
  74. Also see the {file:HAML_REFERENCE.md full <a href="Haml.html">Haml</a>
  75. reference}.
  76. </p>
  77. </div>
  78. <div class="sectiontitle">Methods</div>
  79. <dl class="methods">
  80. <dt>I</dt>
  81. <dd>
  82. <ul>
  83. <li><a href="#M000311">init_rails</a></li>
  84. </ul>
  85. </dd>
  86. </dl>
  87. <div class="sectiontitle">Classes and Modules</div>
  88. <ul>
  89. <li><span class="type">MODULE</span> <a href="Haml/Compiler.html">Haml::Compiler</a></li>
  90. <li><span class="type">MODULE</span> <a href="Haml/Exec.html">Haml::Exec</a></li>
  91. <li><span class="type">MODULE</span> <a href="Haml/Filters.html">Haml::Filters</a></li>
  92. <li><span class="type">MODULE</span> <a href="Haml/Helpers.html">Haml::Helpers</a></li>
  93. <li><span class="type">MODULE</span> <a href="Haml/Parser.html">Haml::Parser</a></li>
  94. <li><span class="type">MODULE</span> <a href="Haml/Shared.html">Haml::Shared</a></li>
  95. <li><span class="type">MODULE</span> <a href="Haml/Template.html">Haml::Template</a></li>
  96. <li><span class="type">MODULE</span> <a href="Haml/Util.html">Haml::Util</a></li>
  97. <li><span class="type">MODULE</span> <a href="Haml/Version.html">Haml::Version</a></li>
  98. <li><span class="type">CLASS</span> <a href="Haml/Buffer.html">Haml::Buffer</a></li>
  99. <li><span class="type">CLASS</span> <a href="Haml/Engine.html">Haml::Engine</a></li>
  100. <li><span class="type">CLASS</span> <a href="Haml/Error.html">Haml::Error</a></li>
  101. <li><span class="type">CLASS</span> <a href="Haml/HTML.html">Haml::HTML</a></li>
  102. <li><span class="type">CLASS</span> <a href="Haml/Plugin.html">Haml::Plugin</a></li>
  103. <li><span class="type">CLASS</span> <a href="Haml/SyntaxError.html">Haml::SyntaxError</a></li>
  104. </ul>
  105. <div class="sectiontitle">Constants</div>
  106. <table border='0' cellpadding='5'>
  107. <tr valign='top'>
  108. <td class="attr-name">ROOT_DIR</td>
  109. <td>=</td>
  110. <td class="attr-value">File.expand_path(File.join(__FILE__, &quot;../../..&quot;))</td>
  111. </tr>
  112. <tr valign='top'>
  113. <td>&nbsp;</td>
  114. <td colspan="2" class="attr-desc"><p>
  115. The root directory of the <a href="Haml.html">Haml</a> source tree. This
  116. may be overridden by the package manager if the lib directory is separated
  117. from the main source tree. @api public
  118. </p>
  119. </td>
  120. </tr>
  121. <tr valign='top'>
  122. <td class="attr-name">VERSION</td>
  123. <td>=</td>
  124. <td class="attr-value">version[:string] unless defined?(Haml::VERSION)</td>
  125. </tr>
  126. <tr valign='top'>
  127. <td>&nbsp;</td>
  128. <td colspan="2" class="attr-desc"><p>
  129. A string representing the version of <a href="Haml.html">Haml</a>. A more
  130. fine-grained representation is available from Haml.version. @api public
  131. </p>
  132. </td>
  133. </tr>
  134. </table>
  135. <div class="sectiontitle">Class Public methods</div>
  136. <div class="method">
  137. <div class="title" id="M000311">
  138. <a name="M000311"></a><b>init_rails</b>(binding)
  139. </div>
  140. <div class="description">
  141. <p>
  142. Initializes <a href="Haml.html">Haml</a> for Rails.
  143. </p>
  144. <p>
  145. This method is called by `init.rb`, which is run by Rails on startup. We
  146. use it rather than putting stuff straight into `init.rb` so we can change
  147. the initialization behavior without modifying the file itself.
  148. </p>
  149. <p>
  150. @param binding [Binding] The context of the `init.rb` file.
  151. </p>
  152. <pre>
  153. This isn't actually used;
  154. it's just passed in in case it needs to be used in the future
  155. </pre>
  156. </div>
  157. <div class="sourcecode">
  158. <p class="source-link">
  159. Source: <a href="javascript:toggleSource('M000311_source')" id="l_M000311_source">show</a>
  160. </p>
  161. <div id="M000311_source" class="dyn-source">
  162. <pre> <span class="ruby-comment cmt"># File lib/haml.rb, line 27</span>
  163. 27: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">init_rails</span>(<span class="ruby-identifier">binding</span>)
  164. 28: <span class="ruby-comment cmt"># 2.2 &lt;= Rails &lt; 3</span>
  165. 29: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rails</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:configuration</span>) <span class="ruby-operator">&amp;&amp;</span>
  166. 30: <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:after_initialize</span>) <span class="ruby-operator">&amp;&amp;</span>
  167. 31: <span class="ruby-operator">!</span><span class="ruby-constant">Haml</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">ap_geq_3?</span>
  168. 32: <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">after_initialize</span> <span class="ruby-keyword kw">do</span>
  169. 33: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Sass</span>)
  170. 34: <span class="ruby-identifier">autoload</span>(<span class="ruby-identifier">:Sass</span>, <span class="ruby-value str">'sass/rails2_shim'</span>)
  171. 35: <span class="ruby-comment cmt"># resolve autoload if it looks like they're using Sass without options</span>
  172. 36: <span class="ruby-constant">Sass</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">RAILS_ROOT</span>, <span class="ruby-value str">'public/stylesheets/sass'</span>))
  173. 37: <span class="ruby-keyword kw">end</span>
  174. 38: <span class="ruby-keyword kw">end</span>
  175. 39:
  176. 40: <span class="ruby-comment cmt"># No &amp;method here for Rails 2.1 compatibility</span>
  177. 41: <span class="ruby-node">%w[haml/template]</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">require</span> <span class="ruby-identifier">f</span>}
  178. 42: <span class="ruby-keyword kw">end</span></pre>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </body>
  185. </html>