Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/postmodern/dm-is-indexed
https://github.com/postmodern/dm-is-indexed
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/postmodern/dm-is-indexed
- Owner: postmodern
- License: mit
- Archived: true
- Created: 2011-03-20T21:13:40.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2017-12-21T22:34:42.000Z (almost 7 years ago)
- Last Synced: 2024-05-01T21:59:48.923Z (6 months ago)
- Language: Ruby
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# dm-is-indexed
* [Homepage](http://github.com/postmodern/dm-is-indexed#readme)
* [Issues](http://github.com/postmodern/dm-is-indexed/issues)
* [Documentation](http://rubydoc.info/gems/dm-is-indexed/frames)
* [Email](mailto:postmodern.mod3 at gmail.com)## Description
dm-is-indexed overloads the `Model[]` method, and allows querying Resources
using their indexed properties.## Examples
require 'dm-is-indexed'
class Atom
include DataMapper::Resource
is :indexed
property :id, Serial
property :symbol, String, :unique => true
property :name, String, :unique => true
property :atomic_weight, Float, :index => true
end
Traditional Array style access is preserved:
Atom[0]
# => #Atom[0,1]
# => [#,
#]Query Resources based on their unique indexed properties:
Atom["Kr"]
# => #Atom["Krpton"]
# => #Atom[83.798]
# => ### Requirements
* [dm-core](http://github.com/datamapper/dm-core#readme) ~> 1.0
## Install
$ gem install dm-is-indexed
## Copyright
Copyright (c) 2011 Hal Brodigan
See {file:LICENSE.txt} for details.