kotp
2/12/2013 - 6:45 PM

Exploring modules, constants and methods

Exploring modules, constants and methods

require './global_var'

include SharedVar

puts GlobalConstant
puts $GlobalConstant_WithDollarSign
puts SharedVar::NAMESPACED_CONSTANT
puts SharedVar::your_method

puts "Loading global_var.rb"

GlobalConstant = 'GlobalConstant'
$GlobalConstant_WithDollarSign = 'Global Constant with Dollar Sign'
module SharedVar
  NAMESPACED_CONSTANT = 'Named spaced constant'

  def your_method
    "Whatever your method would be."
  end
end