Ruby: How to make a public static method?

Your given example is working very well

class Ask
  def self.make_permalink(phrase)
    phrase.strip.downcase.gsub! /\ +/, '-'
  end
end

Ask.make_permalink("make a slug out of this line")

I tried in 1.8.7 and also in 1.9.3 Do you have a typo in you original script?

All the best


There is one more syntax which is has the benefit that you can add more static methods

class TestClass

  # all methods in this block are static
  class << self
    def first_method
      # body omitted
    end

    def second_method_etc
      # body omitted
    end
  end

  # more typing because of the self. but much clear that the method is static
  def self.first_method
    # body omitted
  end

  def self.second_method_etc
    # body omitted
  end
end