1. Technology

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  ...
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 ...
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 ...
Overlooking Input and Output? Using the Input / Output Methods in ...
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 ...
Split and Join - Using Strings in Ruby - About.com
Using the index operator is ideal when you know the location of the portion of the string you want to change. However, it's rare that you'll know the location, ...
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 ...
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 ...
1  |  2  |  3      Next

©2014 About.com. All rights reserved.