With ActiveSupport
you can say:
class Robot
def self.likes_humans?
'Nope.'
end
delegate :likes_humans?, to: :class
end
Robot.likes_humans?
# => 'Nope.'
Robot.new.likes_humans?
# => 'Nope.'
Posted to makandra dev (2015-02-11 19:52)
With ActiveSupport
you can say:
class Robot
def self.likes_humans?
'Nope.'
end
delegate :likes_humans?, to: :class
end
Robot.likes_humans?
# => 'Nope.'
Robot.new.likes_humans?
# => 'Nope.'