README.tmpl in attributes-5.0.0 vs README.tmpl in attributes-5.0.1

- old
+ new

@@ -3,12 +3,13 @@ INSTALL gem install attributes URIS - http://rubyforge.org/projects/codeforpeople/ http://codeforpeople.com/lib/ruby + http://rubyforge.org/projects/codeforpeople/ + http://codeforpeople.rubyforge.org/svn/ SYNOPSIS attributes.rb provides a set of attr_* like method with several user friendly additions. attributes.rb is similar to the traits.rb package but sacrifices a few features for simplicity of implementation. @@ -40,10 +41,13 @@ - attributes can be defined on objects on a per singleton basis as well - getters acts as setters if an argument is given to them + - block caching, calling an attribute with a block sets the instance + variable to that block + all this in < 100 lines of code HISTORY 5.0.0 - added support for block caching. for example @@ -52,12 +56,14 @@ class Filter attribute :process end - (( filter = Filter.new )).process{|line| line.upcase} + filter = Filter.new + filter.process{|line| line.upcase} + lines.each do |line| p filter.process.call(line) end - using block caching to delay block evaluation/class-factory: @@ -65,10 +71,11 @@ module MigrationDSL attribute :migration def migration_class model = self + Class.new(::ActiveRecord::Migration) do singleton_class = class << self self end @@ -84,11 +91,11 @@ class Jobs < Table migration do def up create_table model.table_name, :primary_key => model.primary_key do |t| - t.column 'rockin', :text + t.column 'vinyl_shoes', :text end end def down create_table model.table_name @@ -97,11 +104,9 @@ end ... JobsMigration = Jobs.migration_class - - - cleaned up some warnings under 'ruby -d' 4.1.0 - 4.0.0 introduced a bug where a query (foo?) would not initialize a var - 4.1.0 fixes that