Permalink
Browse files

Add manpage via ronn.

  • Loading branch information...
1 parent a9c80f2 commit 4c39e4d1d0ba9232dc3fabd158ff296d2ada3964 @therealadam committed Feb 19, 2012
Showing with 249 additions and 0 deletions.
  1. +8 −0 Gemfile.lock
  2. +45 −0 man/scam.1
  3. +120 −0 man/scam.1.html
  4. +75 −0 man/scam.1.ronn
  5. +1 −0 scam.gemspec
View
@@ -7,7 +7,14 @@ GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.2)
+ hpricot (0.8.6)
+ mustache (0.99.4)
rake (0.9.2)
+ rdiscount (1.6.8)
+ ronn (0.7.3)
+ hpricot (>= 0.8.2)
+ mustache (>= 0.7.0)
+ rdiscount (>= 1.5.8)
rspec (2.3.0)
rspec-core (~> 2.3.0)
rspec-expectations (~> 2.3.0)
@@ -22,5 +29,6 @@ PLATFORMS
DEPENDENCIES
rake
+ ronn
rspec (~> 2.3)
scam!
View
@@ -0,0 +1,45 @@
+.\" generated with Ronn/v0.7.3
+.\" http://github.com/rtomayko/ronn/tree/0.7.3
+.
+.TH "SCAM" "2" "February 2012" "" ""
+.
+.SH "NAME"
+\fBscam\fR \- Really basic fake models for in\-memory types
+.
+.SH "NAME"
+.
+.SH "SYNOPSIS"
+.
+.nf
+
+class User
+ include Scam
+
+ attr_accessor :name, :username
+end
+
+# Adds create to the scam class
+User\.create(:id => 1, :name => \'Adam Keys\', :username => \'akk\')
+User\.create(:id => 2, :name => \'John Nunemaker\', :username => \'nunes\')
+
+# Adds enumerable methods
+User\.select { |u| u\.username == \'akk\' }
+
+# Adds sorted_by
+# Custom sort
+# Find by ID or string
+# Find by [] method
+# Equality
+.
+.fi
+.
+.SH "DESCRIPTION"
+.
+.SH "EXCEPTIONS"
+.
+.SH "EXAMPLE"
+.
+.SH "SEE ALSO"
+.
+.SH "COPYRIGHT"
+
View
@@ -0,0 +1,120 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv='content-type' value='text/html;charset=utf8'>
+ <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
+ <title>scam(2) - Really basic fake models for in-memory types</title>
+ <style type='text/css' media='all'>
+ /* style: man */
+ body#manpage {margin:0}
+ .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
+ .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
+ .mp h2 {margin:10px 0 0 0}
+ .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
+ .mp h3 {margin:0 0 0 4ex}
+ .mp dt {margin:0;clear:left}
+ .mp dt.flush {float:left;width:8ex}
+ .mp dd {margin:0 0 0 9ex}
+ .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
+ .mp pre {margin-bottom:20px}
+ .mp pre+h2,.mp pre+h3 {margin-top:22px}
+ .mp h2+pre,.mp h3+pre {margin-top:5px}
+ .mp img {display:block;margin:auto}
+ .mp h1.man-title {display:none}
+ .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
+ .mp h2 {font-size:16px;line-height:1.25}
+ .mp h1 {font-size:20px;line-height:2}
+ .mp {text-align:justify;background:#fff}
+ .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
+ .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
+ .mp u {text-decoration:underline}
+ .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
+ .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
+ .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
+ .mp b.man-ref {font-weight:normal;color:#434241}
+ .mp pre {padding:0 4ex}
+ .mp pre code {font-weight:normal;color:#434241}
+ .mp h2+pre,h3+pre {padding-left:0}
+ ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
+ ol.man-decor {width:100%}
+ ol.man-decor li.tl {text-align:left}
+ ol.man-decor li.tc {text-align:center;letter-spacing:4px}
+ ol.man-decor li.tr {text-align:right;float:right}
+ </style>
+</head>
+<!--
+ The following styles are deprecated and will be removed at some point:
+ div#man, div#man ol.man, div#man ol.head, div#man ol.man.
+
+ The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
+ .man-navigation should be used instead.
+-->
+<body id='manpage'>
+ <div class='mp' id='man'>
+
+ <div class='man-navigation' style='display:none'>
+ <a href="#NAME">NAME</a>
+ <a href="#NAME">NAME</a>
+ <a href="#SYNOPSIS">SYNOPSIS</a>
+ <a href="#DESCRIPTION">DESCRIPTION</a>
+ <a href="#EXCEPTIONS">EXCEPTIONS</a>
+ <a href="#EXAMPLE">EXAMPLE</a>
+ <a href="#SEE-ALSO">SEE ALSO</a>
+ <a href="#COPYRIGHT">COPYRIGHT</a>
+ </div>
+
+ <ol class='man-decor man-head man head'>
+ <li class='tl'>scam(2)</li>
+ <li class='tc'></li>
+ <li class='tr'>scam(2)</li>
+ </ol>
+
+ <h2 id="NAME">NAME</h2>
+<p class="man-name">
+ <code>scam</code> - <span class="man-whatis">Really basic fake models for in-memory types</span>
+</p>
+
+<h2 id="NAME">NAME</h2>
+
+<h2 id="SYNOPSIS">SYNOPSIS</h2>
+
+<pre><code>class User
+ include Scam
+
+ attr_accessor :name, :username
+end
+
+# Adds create to the scam class
+User.create(:id =&gt; 1, :name =&gt; 'Adam Keys', :username =&gt; 'akk')
+User.create(:id =&gt; 2, :name =&gt; 'John Nunemaker', :username =&gt; 'nunes')
+
+# Adds enumerable methods
+User.select { |u| u.username == 'akk' }
+
+# Adds sorted_by
+# Custom sort
+# Find by ID or string
+# Find by [] method
+# Equality
+</code></pre>
+
+<h2 id="DESCRIPTION">DESCRIPTION</h2>
+
+<h2 id="EXCEPTIONS">EXCEPTIONS</h2>
+
+<h2 id="EXAMPLE">EXAMPLE</h2>
+
+<h2 id="SEE-ALSO">SEE ALSO</h2>
+
+<h2 id="COPYRIGHT">COPYRIGHT</h2>
+
+
+ <ol class='man-decor man-foot man foot'>
+ <li class='tl'></li>
+ <li class='tc'>February 2012</li>
+ <li class='tr'>scam(2)</li>
+ </ol>
+
+ </div>
+</body>
+</html>
View
@@ -0,0 +1,75 @@
+scam(2) -- Really basic fake models for in-memory types
+=======================================================
+
+## SYNOPSIS
+
+Write your model class. Mix Scam in via `include Scam`. Go eat a sandwich.
+
+- `ScamModel.create(attrs={})`
+- `ScamModel.find(id_or_attributes)`
+- `ScamModel.sorted_by(attribute)`
+- `ScamModel.all`
+- `ScamModel[id]`
+- `ScamModel#==(object)`
+- `ScamModel#eq?(object)`
+
+## DESCRIPTION
+
+Scam is a small mixin for making a class look like an ORM-ish object, ala ActiveRecord, MongoMapper, etc. Classes including `Scam` get a `create` method for creating new instances, `find` and `[]` accessors for looking them up, enumerable methods (`select`, `reject`, etc.) for querying for in-memory models, can define a sort order, and methods for comparing instances.
+
+## USAGE
+
+Include the `Scam` module into your class. This will automatically add an `id` attribute and accessor to your class.
+
+## CREATING MODELS
+
+You can make a new model instance by calling `create` on your class. This method takes a hash specifying the value for all the attributes on the class. At the least, you should pass an `id` value; otherwise, what's the point?
+
+## LOOKING UP MODELS
+
+Once you've created some models, you can look them up with `find` or `[]`. They both take either a number or a string as a parameter and look up model objects by ID. If a model could not be found for the specified ID, `nil` is returned.
+
+## SORTING MODELS
+
+Usually you'll want to sort models by ID; indeed this is the default ordering. However, should you come across a case where you want models to order by some other attribute, you can specify it with `sorted_by`, passing the attribute to sort on.
+
+## LISTING ALL MODELS
+
+Should you need to fetch all the models defined in memory, you can fetch them with `all`. This will return an array of all models created so far.
+
+## COMPARING MODELS
+
+Given two model instances, you can compare them for equality with `==` or `eql?`. They both return true if the instances have the same class and ID; otherwise, they return false.
+
+## ERRORS AND EXCEPTIONS
+
+No exceptions are raised by Scam methods. Enumerable methods (`select`, `detect`, etc.) will return nil if nothing was found.
+
+## EXAMPLE
+
+ class FeedTemplate
+ include Scam
+
+ sorted_by :title
+ attr_accessor :title
+ end
+
+ FeedTemplate.create(:id => 1, :title => 'Twitter')
+ FeedTemplate.create(:id => 2, :title => 'Dribble')
+
+ FeedTemplate.all
+
+ FeedTemplate.each do |tpl|
+ # Tinker with tpl
+ end
+
+ FeedTemplate.detect { |tpl| tpl.title == 'Twitter' }
+
+ FeedTemplate.find(2)
+
+ FeedTemplate.find('2')
+
+## SEE ALSO
+
+* ActiveModel provides goodies like validation, attributes, and reflection.
+* DataMapper classes needn't map to a relational database, so you could use that to implement in-memory models?
View
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
s.description = %q{Really basic fake model for type-ish stuff}
s.add_development_dependency 'rspec', '~> 2.3'
+ s.add_development_dependency 'ronn'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")

0 comments on commit 4c39e4d

Please sign in to comment.