Class: Achievements::Achievement
- Inherits:
-
Object
- Object
- Achievements::Achievement
- Defined in:
- lib/achievements/achievement.rb
Overview
Achievement, basis of counters
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#name ⇒ Object
Returns the value of attribute name.
-
#threshold ⇒ Object
Returns the value of attribute threshold.
Instance Method Summary collapse
-
#initialize(context, name, threshold) ⇒ Achievement
constructor
A method needs a context, name, and threshold, in that order.
-
#to_hash ⇒ Object
Convenience to_hash method.
Constructor Details
#initialize(context, name, threshold) ⇒ Achievement
A method needs a context, name, and threshold, in that order.
11 12 13 14 15 |
# File 'lib/achievements/achievement.rb', line 11 def initialize(context, name, threshold) @context = context @name = name @threshold = threshold end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
7 8 9 |
# File 'lib/achievements/achievement.rb', line 7 def context @context end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/achievements/achievement.rb', line 5 def name @name end |
#threshold ⇒ Object
Returns the value of attribute threshold.
6 7 8 |
# File 'lib/achievements/achievement.rb', line 6 def threshold @threshold end |
Instance Method Details
#to_hash ⇒ Object
Convenience to_hash method
18 19 20 |
# File 'lib/achievements/achievement.rb', line 18 def to_hash {:name => @name, :threshold => @threshold, :context => @context} end |