README.md in has_meta-0.0.2 vs README.md in has_meta-0.0.3

- old
+ new

@@ -1,11 +1,11 @@ # HasMeta [![Gem Version](https://badge.fury.io/rb/has_meta.png)](http://badge.fury.io/rb/has_meta) Adds convenience methods to extract "meta" (as in http meta) strings from -models by using existing fields for source data. Strings are stripped of html +models by using existing fields or lambda/Procs for source data. Result is stripped of html tags and truncated to length (default 255). ## Installation Add this line to your application's Gemfile: @@ -21,11 +21,17 @@ $ gem install has_meta ## Usage class BlogPost < ActiveRecord::Base - has_meta :keywords => :keywords, :description => [:short_description, :content] + has_meta :keywords => :keywords, + :description => [:short_description, :content], + :foo => lambda {|o| o.some_instance_method } + + def some_instance_method + Time.now + end end bp = BlogPost.new(...) bp.meta_keywords == bp.meta_keywords @@ -33,9 +39,14 @@ # if short_description is not blank and less than 255 characters then bp.meta_description == bp.short_description # if short_description is blank then bp.meta_description == bp.content.slice(0,255) + + # blocks will be passed an instance of the object itself + bp.meta_foo == "Feb 27, 4:36:00 PM" # for example + sleep 1 + bp.meta_foo == "Feb 27, 4:36:01 PM" # one second later ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`)