lib/has_meta.rb in has_meta-0.0.6 vs lib/has_meta.rb in has_meta-0.0.7

- old
+ new

@@ -1,20 +1,23 @@ require 'cgi' require 'active_record' require 'has_meta/version' module HasMeta + + OPTIONS = {:truncate => 255} + module Extensions def self.included(base) base.extend(ClassMethods) end module ClassMethods def has_meta(options = {}) options.each_pair do |meth, fields| define_method("meta_#{meth}") {|*args| length = args.first if args.is_a? Array - length ||= 255 + length ||= HasMeta::OPTIONS[:truncate] if fields.is_a? Proc str = fields.call(self) else field = [*fields].detect{|f| send(f).present?}