Class: Partyhat::SkillComparison
- Inherits:
-
Object
- Object
- Partyhat::SkillComparison
- Defined in:
- lib/partyhat/skill_comparison.rb
Instance Method Summary collapse
- #experience ⇒ Object
-
#initialize(first_skill, second_skill) ⇒ SkillComparison
constructor
A new instance of SkillComparison.
- #level ⇒ Object
- #rank ⇒ Object
Constructor Details
#initialize(first_skill, second_skill) ⇒ SkillComparison
Returns a new instance of SkillComparison.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/partyhat/skill_comparison.rb', line 9 def initialize first_skill, second_skill # Check the classes so they don't fail unless (first_skill.class == Partyhat::Skill) && (second_skill.class == Partyhat::Skill) raise InvalidArgumentError 'You can only compare two Skill objects.' end # Assign instance variables @first_skill = first_skill @second_skill = second_skill # Perform comparison @level = @second_skill.level - @first_skill.level @experience = @second_skill.experience - @first_skill.experience @rank = @second_skill.rank - @first_skill.rank end |
Instance Method Details
#experience ⇒ Object
27 28 29 |
# File 'lib/partyhat/skill_comparison.rb', line 27 def experience @experience end |
#level ⇒ Object
23 24 25 |
# File 'lib/partyhat/skill_comparison.rb', line 23 def level @level end |
#rank ⇒ Object
31 32 33 |
# File 'lib/partyhat/skill_comparison.rb', line 31 def rank @rank end |