Mega Code Archive

 
Categories / Ruby / Method
 

Call a function for a parameter with or without parenthesis

string = 'My first string'                   # => "My first string" string.count 'i'                             # => 2   # "i" occurs twice. string.count('i')                            # => 2