Class: Scorecard::AppliedBadge

Inherits:
Object
  • Object
show all
Defined in:
lib/scorecard/applied_badge.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier, user) ⇒ AppliedBadge

Returns a new instance of AppliedBadge.



6
7
8
9
# File 'lib/scorecard/applied_badge.rb', line 6

def initialize(identifier, user)
  @user  = user
  @badge = Scorecard.badges.find identifier
end

Instance Attribute Details

#badgeObject

Returns the value of attribute badge.



2
3
4
# File 'lib/scorecard/applied_badge.rb', line 2

def badge
  @badge
end

#userObject

Returns the value of attribute user.



2
3
4
# File 'lib/scorecard/applied_badge.rb', line 2

def user
  @user
end

Instance Method Details

#countObject



11
12
13
# File 'lib/scorecard/applied_badge.rb', line 11

def count
  Scorecard::UserBadge.for(badge.identifier, user).count
end

#gameablesObject



15
16
17
# File 'lib/scorecard/applied_badge.rb', line 15

def gameables
  Scorecard::UserBadge.for(badge.identifier, user).collect &:gameable
end