Tech stuff around computer programming, basically for web development, especially opensource. Topics will go round Ruby on Rails (git gems etc.), Ubuntu (admin and basic shell) and work organization (agile philosophy)
Wednesday, 2 May 2012
define class methods in ruby (private too)
The following syntax could be used for defining the find method itself, but it is mandatory for alias.
class Item
def self.find(name)
# ...
end
class << self
alias :search :find
end
private_class_method :find # writing it below private is not enough
end
No comments:
Post a Comment