module Haml module Version # Returns a hash representing the version of Haml. # The :major, :minor, and :teeny keys have their respective numbers. # The :string key contains a human-readable string representation of the version. # If Haml is checked out from Git, # the :rev key will have the revision hash. def version return @@version if defined?(@@version) dir = File.dirname(__FILE__) @@version = YAML.load(File.read("#{dir}/../../VERSION.yml")) @@version.each do |key, value| @@version[key.to_sym] = value end @@version[:teeny] = @@version.delete(:patch) @@version[:string] = "#{@@version[:major]}.#{@@version[:minor]}.#{@@version[:teeny]}" @@version end # Returns the path of file relative to the Haml root. def scope(file) # :nodoc: File.expand_path File.join(File.dirname(__FILE__), '..', '..', file) end end end