Class: Partyhat::Activity

Inherits:
Stat
  • Object
show all
Defined in:
lib/partyhat/activity.rb

Constant Summary

Constants inherited from Stat

Stat::ActivitiesList, Stat::CombatSkillsList, Stat::HumanNames, Stat::List, Stat::SkillsList

Instance Method Summary collapse

Methods inherited from Stat

human_name_for

Constructor Details

#initialize(name, score, rank) ⇒ Activity

Returns a new instance of Activity.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
# File 'lib/partyhat/activity.rb', line 7

def initialize name, score, rank
  raise ArgumentError, 'Invalid activity name' unless ActivitiesList.include? name
  @name  = name
  @score = score < 0 ? nil : score
  @rank  = rank < 0 ? nil : rank
end

Instance Method Details

#compare_to(another_activity) ⇒ Object



30
31
32
# File 'lib/partyhat/activity.rb', line 30

def compare_to another_activity
  Partyhat::ActivityComparison.new(self, another_activity)
end

#human_nameObject



18
19
20
# File 'lib/partyhat/activity.rb', line 18

def human_name
  Partyhat::Stat.human_name_for @name
end

#nameObject



14
15
16
# File 'lib/partyhat/activity.rb', line 14

def name
  @name
end

#rankObject



26
27
28
# File 'lib/partyhat/activity.rb', line 26

def rank
  @rank
end

#scoreObject



22
23
24
# File 'lib/partyhat/activity.rb', line 22

def score
  @score
end