String.class_eval do def to_reader self.to_sym end def to_writer "#{self}=".to_sym end def to_iv "@#{self}" end def interpolate binding binding.should! :be_a, Binding return gsub(/\#\{.+?\}/) do |term| identifier = term.slice(2 .. term.size-2) binding.eval identifier end end def self.secure_token original = [Time.now, (1..10).map{ rand.to_s }] Digest::SHA1.hexdigest(original.flatten.join('--')) end end