1. Tech

Articles related to to_s

Data Visualization - Ruby - About.com
We're going to hijack (or, more accurately, implement) the Node#to_s method. It should iterate over the tree, starting at itself (so if we want the whole tree, we call  ...
Symbols - Ruby - About.com
To test for a symbol without creating it, you could convert all the symbols to strings (using :some_symbol.to_s and test for the identifying strings. There is no real ...
Method for Mapping the Values of an Array - Ruby - About.com
So, if we have an array of numbers but we want strings, we can do something like this. [ 1, 2, 3, 4 ].map(&:to_s) # This will produce the array [ "1", "2", "3", "4" ].
Getting and Printing Strings - Ruby - About.com
Aug 17, 2011 ... If the object you pass to puts is not a string, the puts method will attempt to call to_s on that object. For example, if I were to pass a number to ...
Using the Input / Output Methods in Ruby - About.com
For objects of all other types, puts will first call the object's to_s method which attempts to convert the object to a string, then prints the result of to_s followed by a ...
Simple Programming under Linux - About.com
print "You entered " + a.length.to_s + " entries.\n\n" for i in 0...a.length do print " Entry " + (i+1).to_s + ": "+ a[i] + "\n" end. I save my ruby script to file "myprogram".
Cryptographic Hashes in Ruby - About.com
Whenever you want the hash, you can read it from the hexdigest method or simply from its to_s method. #!/usr/bin/env ruby # Computes the SHA1 hash of any ...
Block Parameters and Yielding - Ruby - About.com
... implicit Proc object ret = yield puts %Q{The block yielded "#{ret.to_s}"} end yield_and_print{ 10 } yield_and_print{ "Hello" } yield_and_print do (10 + 20) / 3 end ...
Part 3: Implementing - Ruby - About.com
def to_param if self.desc.nil? b36_id else "#{b36_id}/#{self.desc}" end end def b36_id self.id.to_i.to_s(36) end end. The first line is the attr_accessible line that ...
Spotlight on Gems: TMail - Ruby - About.com
Once the email message is created, you can call the to_s method to convert it back into a string. Then it can be sent with the Net::SMTP library or storing on disk .
1  |  2      Next

©2014 About.com. All rights reserved.