# What symbol for class methods?

**URL:** <https://www.ruby-forum.com/t/what-symbol-for-class-methods/161593>\
**Category:** Ruby\
**Created:** [February 27, 2009, 5:56pm UTC](https://www.ruby-forum.com/t/what-symbol-for-class-methods/161593 "2009-02-27T17:56:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [February 27, 2009, 5:56pm UTC](https://www.ruby-forum.com/t/what-symbol-for-class-methods/161593/1 "2009-02-27T17:56:59Z")

</div>

Hello,  
some methods require as an argument a symbol of a method (e.g.  
alias\_method). How can one use it with class methods?

Thanks.

Diego

---

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [February 27, 2009, 7:04pm UTC](https://www.ruby-forum.com/t/what-symbol-for-class-methods/161593/2 "2009-02-27T19:04:52Z")

</div>

Diego V. wrote:

> Hello,  
> some methods require as an argument a symbol of a method (e.g.  
> alias\_method). How can one use it with class methods?
> 
> Thanks.
> 
> Diego

class A  
def A.show(symbol)  
puts “%s \<–\> %s” % [symbol.inspect, symbol.to\_s]  
end  
end

A.show(:hello)

–output:–  
:hello \<–\> hello

---

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [February 27, 2009, 10:02pm UTC](https://www.ruby-forum.com/t/what-symbol-for-class-methods/161593/3 "2009-02-27T22:02:02Z")

</div>

Diego V. wrote:

> Hello,  
> some methods require as an argument a symbol of a method (e.g.  
> alias\_method). How can one use it with class methods?

Hmm…what does ‘it’ refer to? Does ‘it’ refers to alias\_method?

As far as I can tell, you can’t use alias\_method with symbols like:

:self.meth\_name

for arguments. However, this seems to work:

class A  
def self.greet  
puts “hello”  
end

class\<\<self  
alias\_method :old\_greet, :greet  
end

end

A.old\_greet #hello
