bazz1tv / ayumi

My lovely IRC bot :sparkles: :turtle: :mailbox: :sparkles:
0 stars 1 forks source link

de-module-ize the highscores/suggestions into classes #27

Open bazz1tv opened 8 years ago

bazz1tv commented 8 years ago

Here's an example of how that could be done.

class A
  def initialize(owner)
    @owner = owner
  end

  def owner_name
    @owner.class.name.split("::").last
  end

  def do_stuff
    puts owner_name
  end
end

class B
  def initialize
    @a = A.new(self)
  end

  def do_stuff
    @a.do_stuff
  end
end

b = B.new

b.do_stuff
bazz1tv commented 8 years ago

Needs a refactor now.

so you'll see highscores.inc_highscore(user) which could probably just be highscores.inc(user)

TheNotary commented 8 years ago

actually, what about making it more OO, like:

user.score.inc