Permalink
Browse files

minor rdoc formatting update

  • Loading branch information...
1 parent 14fc591 commit e3f13a17daf3bc03f264b5f88bb77a1b60dc4681 @Squeegy Squeegy committed Apr 3, 2008
View
@@ -30,9 +30,9 @@ Fleximage uses a simple templating engine that allows you to re-render images ex
* Require absolutely zero controller code.
-== Getting Started
+= Getting Started
-=== 1. Installing the plugin
+== 1. Installing the plugin
If running on rails edge:
@@ -45,7 +45,7 @@ http://github.com/Squeegy/fleximage/tarball/master
Unzip, and place the root +fleximage+ folder in your <tt>railsapproot/vendor/plugins</tt> directory.
-=== 2. Activating your model
+== 2. Activating your model
You need to let your model know it should be Fleximage friendly. Lets say you have a model for photos.
@@ -59,7 +59,7 @@ The :+image_directory+ option tells the plugin where to store your master images
There are many other options for your model. Refer to the <tt>Fleximage::Model::ClassMethods</tt> class in the +rdoc+ for more information on these.
-=== 3. The upload form
+== 3. The upload form
Your users need a way to upload their images into your site. Here is how we might render a form to create a photo record.
@@ -117,7 +117,7 @@ When the user submits the form, all you have to do is assign the form contents t
end
-=== 4. Linking to the generated images
+== 4. Linking to the generated images
Rails 2 has amazing support for format driven responses. Given a photo object, by default it would have an HTML view that describes information about that photo. With Fleximage, the JPG or (GIF or PNG) view can be the image data itself.
@@ -145,7 +145,7 @@ That image tag uses a Rails route as its +src+. In this case, that route corres
This is the URL where the image will be.
-=== 5. Rendering the image
+== 5. Rendering the image
Now it's time to actually create a template to render the image. This happens through a special view with a .+flexi+ extension. This view template will pull out the master image for you, and send it to the browser as binary data after your processing of it done.
@@ -55,6 +55,10 @@
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
+ <a href="../files/lib/fleximage/image_proxy_rb.html">
+ lib/fleximage/image_proxy.rb
+ </a>
+ <br />
<a href="../files/lib/fleximage/model_rb.html">
lib/fleximage/model.rb
</a>
@@ -129,6 +133,7 @@ <h3 class="section-bar">Classes and Modules</h3>
Module <a href="Fleximage/Model.html" class="link">Fleximage::Model</a><br />
Module <a href="Fleximage/Operator.html" class="link">Fleximage::Operator</a><br />
+Class <a href="Fleximage/ImageProxy.html" class="link">Fleximage::ImageProxy</a><br />
</div>
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Fleximage::ImageProxy</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Fleximage::ImageProxy</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../../files/lib/fleximage/image_proxy_rb.html">
+ lib/fleximage/image_proxy.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+An instance of this class is yielded when Model#operate is called. It
+enables image operators to be called to transform the image. You should
+never need to directly deal with this class. You simply call image
+operators on this object when inside an Model#operate block
+</p>
+<pre>
+ @photo.operate do |image|
+ image.resize '640x480'
+ end
+</pre>
+<p>
+In this example, <tt>image</tt> is an instance of <a
+href="ImageProxy.html">ImageProxy</a>
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000026">method_missing</a>&nbsp;&nbsp;
+ <a href="#M000025">new</a>&nbsp;&nbsp;
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">image</td>
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
+ <td class="context-item-desc">
+The image to be manipulated by operators.
+
+</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000025" class="method-detail">
+ <a name="M000025"></a>
+
+ <div class="method-heading">
+ <a href="#M000025" class="method-signature">
+ <span class="method-name">new</span><span class="method-args">(image)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a <a href="ImageProxy.html#M000025">new</a> image operator proxy.
+Just provide the name of the image
+</p>
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000025-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/fleximage/image_proxy.rb, line 18</span>
+18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">image</span>)
+19: <span class="ruby-ivar">@image</span> = <span class="ruby-identifier">image</span>
+20: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000026" class="method-detail">
+ <a name="M000026"></a>
+
+ <div class="method-heading">
+ <a href="#M000026" class="method-signature">
+ <span class="method-name">method_missing</span><span class="method-args">(method_name, *args)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+A call to an unknown method will look for an <a
+href="Operator.html">Operator</a> by that method&#8216;s name. If it finds
+one, it will execute that operator, otherwise it will simply call super for
+the default method missing behavior.
+</p>
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000026-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/fleximage/image_proxy.rb, line 25</span>
+25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
+26: <span class="ruby-comment cmt"># Find the operator class</span>
+27: <span class="ruby-identifier">operator_class</span> = <span class="ruby-node">&quot;Fleximage::Operator::#{method_name.to_s.camelcase}&quot;</span>.<span class="ruby-identifier">constantize</span>
+28:
+29: <span class="ruby-comment cmt"># Execute the operator</span>
+30: <span class="ruby-ivar">@image</span> = <span class="ruby-identifier">operator_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-ivar">@image</span>).<span class="ruby-identifier">execute</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
+31:
+32: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NameError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
+33: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/uninitialized constant Fleximage::Operator::/</span>
+34: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;No correspoding operator found for the method \&quot;#{method}\&quot;&quot;</span>
+35: <span class="ruby-keyword kw">else</span>
+36: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
+37: <span class="ruby-keyword kw">end</span>
+38: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
Oops, something went wrong.

0 comments on commit e3f13a1

Please sign in to comment.