Sha256: 54368996f24236f072ba781a289e00ee4bb4b4fea2624a3042a53ab86bcaeba5

Contents?: true

Size: 466 Bytes

Versions: 6

Compression:

Stored size: 466 Bytes

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-ext-0.2.16 lib/ruby_ext/string.rb
ruby-ext-0.2.15 lib/ruby_ext/string.rb
ruby-ext-0.2.13 lib/ruby_ext/string.rb
ruby-ext-0.2.12 lib/ruby_ext/string.rb
ruby-ext-0.2.11 lib/ruby_ext/string.rb
ruby-ext-0.2.10 lib/ruby_ext/string.rb