title: . vs :: (dot vs. double-colon) for calling a method
body: <p>I am learning Ruby from the <a href="http://www.rubyinside.com/media/poignant-guide.pdf" rel="noreferrer">Poignant Guide to Ruby</a> and in some of the code examples, I came across uses of the double colon and dot that seem to be used for the same purpose:</p>
  
  <pre><code>File::open( 'idea-' + idea_name + '.txt', 'w' ) do |f|
     f &lt;&lt; idea
  end
  </code></pre>
  
  <p>In the above code, the double colon is being used to access the <code>open</code> method of the <code>File</code> class. However, I later came across code that used a dot for the same purpose: </p>
  
  <pre><code>require 'wordlist'
  # Print each idea out with the words fixed
  Dir['idea-*.txt'].each do |file_name|
     idea = File.read( file_name )
     code_words.each do |real, code| 
       idea.gsub!( code, real )
     end
  puts idea
  end 
  </code></pre>
  
  <p>This time, a dot is being used to access the <code>read</code> method of the <code>File</code> class. What is the difference between:</p>
  
  <pre><code>File.read()
  </code></pre>
  
  <p>and </p>
  
  <pre><code>File::open()
  </code></pre>