Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Create gh-pages branch via GitHub

  • Loading branch information...
commit d89e8d58f315fdf4448d7b304efae2019b1a92e3 1 parent bd2803c
@jnunemaker jnunemaker authored
Showing with 14 additions and 10 deletions.
  1. +13 −9 index.html
  2. +1 −1  params.json
View
22 index.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Plucky by jnunemaker</title>
-
+
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
@@ -17,23 +17,29 @@
<header>
<h1>Plucky</h1>
<p>Thin layer over the ruby driver that allows you to quickly grab hold of your data.</p>
+
<p class="view"><a href="https://github.com/jnunemaker/plucky">View the Project on GitHub <small>jnunemaker/plucky</small></a></p>
+
+
<ul>
<li><a href="https://github.com/jnunemaker/plucky/zipball/master">Download <strong>ZIP File</strong></a></li>
<li><a href="https://github.com/jnunemaker/plucky/tarball/master">Download <strong>TAR Ball</strong></a></li>
- <li><a href="https://github.com/jnunemaker/plucky">Fork On <strong>GitHub</strong></a></li>
+ <li><a href="https://github.com/jnunemaker/plucky">View On <strong>GitHub</strong></a></li>
</ul>
</header>
<section>
- <h2>Install</h2>
+ <h1>Plucky</h1>
+
+<p>Thin layer over the ruby driver that allows you to quickly grab hold of your data (pluck it!).</p>
+
+<h2>Install</h2>
<pre><code>gem install plucky
</code></pre>
<h2>Examples</h2>
-<div class="highlight">
-<pre><span class="n">connection</span> <span class="o">=</span> <span class="no">Mongo</span><span class="o">::</span><span class="no">Connection</span><span class="o">.</span><span class="n">new</span>
+<div class="highlight"><pre><span class="n">connection</span> <span class="o">=</span> <span class="ss">Mongo</span><span class="p">:</span><span class="ss">:MongoClient</span><span class="o">.</span><span class="n">new</span>
<span class="n">db</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">db</span><span class="p">(</span><span class="s1">'test'</span><span class="p">)</span>
<span class="n">collection</span> <span class="o">=</span> <span class="n">db</span><span class="o">[</span><span class="s1">'users'</span><span class="o">]</span>
<span class="n">collection</span><span class="o">.</span><span class="n">remove</span> <span class="c1"># clear out the collection</span>
@@ -43,7 +49,7 @@
<span class="n">collection</span><span class="o">.</span><span class="n">insert</span><span class="p">({</span><span class="s1">'_id'</span> <span class="o">=&gt;</span> <span class="s1">'john'</span><span class="p">,</span> <span class="s1">'age'</span> <span class="o">=&gt;</span> <span class="mi">28</span><span class="p">,</span> <span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="s1">'John'</span><span class="p">})</span>
<span class="c1"># initialize query with collection</span>
-<span class="n">query</span> <span class="o">=</span> <span class="no">Plucky</span><span class="o">::</span><span class="no">Query</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">collection</span><span class="p">)</span>
+<span class="n">query</span> <span class="o">=</span> <span class="ss">Plucky</span><span class="p">:</span><span class="ss">:Query</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">collection</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s1">'Querying'</span>
<span class="n">pp</span> <span class="n">query</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="ss">:name</span> <span class="o">=&gt;</span> <span class="s1">'John'</span><span class="p">)</span><span class="o">.</span><span class="n">first</span>
@@ -104,9 +110,7 @@
<span class="n">pp</span> <span class="n">query</span><span class="o">.</span><span class="n">count</span> <span class="c1"># 1</span>
<span class="n">query</span><span class="o">.</span><span class="n">remove</span>
<span class="n">pp</span> <span class="n">query</span><span class="o">.</span><span class="n">count</span> <span class="c1"># 0</span>
-</pre>
-</div>
-
+</pre></div>
<h2>Help</h2>
View
2  params.json
@@ -1 +1 @@
-{"name":"Plucky","body":"## Install\r\n\r\n```\r\ngem install plucky\r\n```\r\n\r\n## Examples\r\n\r\n```ruby\r\nconnection = Mongo::Connection.new\r\ndb = connection.db('test')\r\ncollection = db['users']\r\ncollection.remove # clear out the collection\r\n\r\ncollection.insert({'_id' => 'chris', 'age' => 26, 'name' => 'Chris'})\r\ncollection.insert({'_id' => 'steve', 'age' => 29, 'name' => 'Steve'})\r\ncollection.insert({'_id' => 'john', 'age' => 28, 'name' => 'John'})\r\n\r\n# initialize query with collection\r\nquery = Plucky::Query.new(collection)\r\n\r\nputs 'Querying'\r\npp query.where(:name => 'John').first\r\npp query.first(:name => 'John')\r\npp query.where(:name => 'John').all\r\npp query.all(:name => 'John')\r\n\r\nputs 'Find by _id'\r\npp query.find('chris')\r\npp query.find('chris', 'steve')\r\npp query.find(['chris', 'steve'])\r\n\r\nputs 'Sort'\r\npp query.sort(:age).all\r\npp query.sort(:age.asc).all # same as above\r\npp query.sort(:age.desc).all\r\npp query.sort(:age).last # steve\r\n\r\nputs 'Counting'\r\npp query.count # 3\r\npp query.size # 3\r\npp query.count(:name => 'John') # 1\r\npp query.where(:name => 'John').count # 1\r\npp query.where(:name => 'John').size # 1\r\n\r\nputs 'Distinct'\r\npp query.distinct(:age) # [26, 29, 28]\r\n\r\nputs 'Select only certain fields'\r\npp query.fields(:age).find('chris') # {\"_id\"=>\"chris\", \"age\"=>26}\r\npp query.only(:age).find('chris') # {\"_id\"=>\"chris\", \"age\"=>26}\r\npp query.ignore(:name).find('chris') # {\"_id\"=>\"chris\", \"age\"=>26}\r\n\r\nputs 'Pagination, yeah we got that'\r\npp query.sort(:age).paginate(:per_page => 1, :page => 2)\r\npp query.sort(:age).per_page(1).paginate(:page => 2)\r\n\r\npp query.sort(:age).limit(2).to_a # [chris, john]\r\npp query.sort(:age).skip(1).limit(2).to_a # [john, steve]\r\npp query.sort(:age).offset(1).limit(2).to_a # [john, steve]\r\n\r\nputs 'Using a cursor'\r\ncursor = query.find_each(:sort => :age) do |doc|\r\n pp doc\r\nend\r\npp cursor\r\n\r\nputs 'Symbol Operators'\r\npp query.where(:age.gt => 28).count # 1 (steve)\r\npp query.where(:age.lt => 28).count # 1 (chris)\r\npp query.where(:age.in => [26, 28]).to_a # [chris, john]\r\npp query.where(:age.nin => [26, 28]).to_a # [steve]\r\n\r\nputs 'Removing'\r\nquery.remove(:name => 'John')\r\npp query.count # 2\r\nquery.where(:name => 'Chris').remove\r\npp query.count # 1\r\nquery.remove\r\npp query.count # 0\r\n```\r\n\r\n## Help\r\n\r\nhttps://groups.google.com/forum/#!forum/mongomapper\r\n\r\n## Contributing\r\n\r\n* Fork the project.\r\n* Make your feature addition or bug fix.\r\n* Add tests for it. This is important so I don't break it in a future version unintentionally.\r\n* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)\r\n* Send me a pull request. Bonus points for topic branches.\r\n\r\n## Copyright\r\n\r\nCopyright (c) 2010 John Nunemaker. See LICENSE for details.\r\n","tagline":"Thin layer over the ruby driver that allows you to quickly grab hold of your data.","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
+{"name":"Plucky","tagline":"Thin layer over the ruby driver that allows you to quickly grab hold of your data.","body":"# Plucky\r\n\r\nThin layer over the ruby driver that allows you to quickly grab hold of your data (pluck it!).\r\n\r\n## Install\r\n\r\n```\r\ngem install plucky\r\n```\r\n\r\n## Examples\r\n\r\n```ruby\r\nconnection = Mongo::MongoClient.new\r\ndb = connection.db('test')\r\ncollection = db['users']\r\ncollection.remove # clear out the collection\r\n\r\ncollection.insert({'_id' => 'chris', 'age' => 26, 'name' => 'Chris'})\r\ncollection.insert({'_id' => 'steve', 'age' => 29, 'name' => 'Steve'})\r\ncollection.insert({'_id' => 'john', 'age' => 28, 'name' => 'John'})\r\n\r\n# initialize query with collection\r\nquery = Plucky::Query.new(collection)\r\n\r\nputs 'Querying'\r\npp query.where(:name => 'John').first\r\npp query.first(:name => 'John')\r\npp query.where(:name => 'John').all\r\npp query.all(:name => 'John')\r\n\r\nputs 'Find by _id'\r\npp query.find('chris')\r\npp query.find('chris', 'steve')\r\npp query.find(['chris', 'steve'])\r\n\r\nputs 'Sort'\r\npp query.sort(:age).all\r\npp query.sort(:age.asc).all # same as above\r\npp query.sort(:age.desc).all\r\npp query.sort(:age).last # steve\r\n\r\nputs 'Counting'\r\npp query.count # 3\r\npp query.size # 3\r\npp query.count(:name => 'John') # 1\r\npp query.where(:name => 'John').count # 1\r\npp query.where(:name => 'John').size # 1\r\n\r\nputs 'Distinct'\r\npp query.distinct(:age) # [26, 29, 28]\r\n\r\nputs 'Select only certain fields'\r\npp query.fields(:age).find('chris') # {\"_id\"=>\"chris\", \"age\"=>26}\r\npp query.only(:age).find('chris') # {\"_id\"=>\"chris\", \"age\"=>26}\r\npp query.ignore(:name).find('chris') # {\"_id\"=>\"chris\", \"age\"=>26}\r\n\r\nputs 'Pagination, yeah we got that'\r\npp query.sort(:age).paginate(:per_page => 1, :page => 2)\r\npp query.sort(:age).per_page(1).paginate(:page => 2)\r\n\r\npp query.sort(:age).limit(2).to_a # [chris, john]\r\npp query.sort(:age).skip(1).limit(2).to_a # [john, steve]\r\npp query.sort(:age).offset(1).limit(2).to_a # [john, steve]\r\n\r\nputs 'Using a cursor'\r\ncursor = query.find_each(:sort => :age) do |doc|\r\n pp doc\r\nend\r\npp cursor\r\n\r\nputs 'Symbol Operators'\r\npp query.where(:age.gt => 28).count # 1 (steve)\r\npp query.where(:age.lt => 28).count # 1 (chris)\r\npp query.where(:age.in => [26, 28]).to_a # [chris, john]\r\npp query.where(:age.nin => [26, 28]).to_a # [steve]\r\n\r\nputs 'Removing'\r\nquery.remove(:name => 'John')\r\npp query.count # 2\r\nquery.where(:name => 'Chris').remove\r\npp query.count # 1\r\nquery.remove\r\npp query.count # 0\r\n```\r\n\r\n## Help\r\n\r\nhttps://groups.google.com/forum/#!forum/mongomapper\r\n\r\n## Contributing\r\n\r\n* Fork the project.\r\n* Make your feature addition or bug fix.\r\n* Add tests for it. This is important so I don't break it in a future version unintentionally.\r\n* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)\r\n* Send me a pull request. Bonus points for topic branches.\r\n\r\n## Copyright\r\n\r\nCopyright (c) 2010 John Nunemaker. See LICENSE for details.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
Please sign in to comment.
Something went wrong with that request. Please try again.