README in dm-is-reflective-0.8.0 vs README in dm-is-reflective-0.9.0

- old
+ new

@@ -1,14 +1,14 @@ -= dm-is-reflective 0.8.0 += dm-is-reflective 0.9.0 by Lin Jen-Shin (aka godfat-真常[http://godfat.org]) godfat (XD) godfat.org == LINKS: -* rdoc[http://ludy.rubyforge.org/dm-is-reflective] -* github-project[http://github.com/godfat/dm-is-reflective] -* rubyforge-project[http://rubyforge.org/projects/ludy] +* {github}[http://github.com/godfat/dm-is-reflective] +* {rubygems}[http://rubygems.org/gems/dm-is-reflective] +* {rdoc}[http://rdoc.info/projects/godfat/dm-is-reflective] == DESCRIPTION: DataMapper plugin that helps you manipulate an existing database. It creates mappings between existing columns and model's properties. @@ -21,58 +21,58 @@ class User include DataMapper::Resource is :reflective # mapping all, returns an array of properties indicating fields it mapped - mapping /.*/ # e.g. => [#<Property:#<Class:0x18f89b8>:id>, + reflect /.*/ # e.g. => [#<Property:#<Class:0x18f89b8>:id>, # #<Property:#<Class:0x18f89b8>:title>, # #<Property:#<Class:0x18f89b8>:body>, # #<Property:#<Class:0x18f89b8>:user_id>] # mapping all (with no argument at all) - mapping + reflect # mapping for field name ended with _at, and started with salt_ - mapping /_at$/, /^salt_/ + reflect /_at$/, /^salt_/ # mapping id and email - mapping :id, :email + reflect :id, :email # mapping all fields with type String, and id - mapping String, :id + reflect String, :id # mapping login, and all fields with type Integer - mapping :login, Integer + reflect :login, Integer end # there's no guarantee of the order in storages array dm.storages # => ['users'] # there's no guarantee of the order in fields array User.fields - # => [[:created_at, DateTime, {:nullable => true}], - [:email, String, {:nullable => true, :length => 255, + # => [[:created_at, DateTime, {:required => false}], + [:email, String, {:required => false, :length => 255, :default => 'nospam@nospam.tw'}], - [:id, Serial, {:nullable => false, :serial => true, + [:id, Serial, {:required => true, :serial => true, :key => true}], - [:salt_first, String, {:nullable => true, :length => 50}], - [:salt_second, String, {:nullable => true, :length => 50}]] + [:salt_first, String, {:required => false, :length => 50}], + [:salt_second, String, {:required => false, :length => 50}]] dm.fields('users').sort_by{ |field| field.first.to_s } == User.fields.sort_by{ |field| field.first.to_s } # => true dm.storages_and_fields - # => {'users' => [[:id, Serial, {:nullable => false, + # => {'users' => [[:id, Serial, {:required => true, :serial => true, :key => true}], - [:email, String, {:nullable => true, + [:email, String, {:required => false, :default => 'nospam@nospam.tw'}], - [:created_at, DateTime, {:nullable => true}], - [:salt_first, String, {:nullable => true, :length => 50}], - [:salt_second, String, {:nullable => true, :length => 50}]]} + [:created_at, DateTime, {:required => false}], + [:salt_first, String, {:required => false, :length => 50}], + [:salt_second, String, {:required => false, :length => 50}]]} # there's no guarantee of the order in returned array dm.auto_genclass! # => [DataMapper::Is::Reflective::User, DataMapper::Is::Reflective::SchemaInfo, @@ -94,21 +94,21 @@ dm.auto_genclass! :storages => 'users' # => [DataMapper::Is::Reflective::User] == REQUIREMENTS: -* dm-core 0.10.0 or later -* at least one do_* adapter +* dm-core 1.0.0 or later +* at least one dm-*-adapter == INSTALL: -> sudo gem install dm-is-reflective +> gem install dm-is-reflective == LICENSE: Apache License 2.0 - Copyright (c) 2008, Lin Jen-Shin (aka godfat 真常) + Copyright (c) 2008-2010, Lin Jen-Shin (aka godfat 真常) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at