Class: Scorecard::Progressions
- Inherits:
-
Object
- Object
- Scorecard::Progressions
- Includes:
- Enumerable
- Defined in:
- lib/scorecard/progressions.rb
Instance Attribute Summary collapse
-
#progressions ⇒ Object
readonly
Returns the value of attribute progressions.
Instance Method Summary collapse
- #add(identifier, amount, &block) ⇒ Object
- #clear ⇒ Object
- #each(&block) ⇒ Object
- #find(identifier) ⇒ Object
-
#initialize ⇒ Progressions
constructor
A new instance of Progressions.
- #without(identifiers) ⇒ Object
Constructor Details
#initialize ⇒ Progressions
Returns a new instance of Progressions.
6 7 8 |
# File 'lib/scorecard/progressions.rb', line 6 def initialize @progressions = [] end |
Instance Attribute Details
#progressions ⇒ Object (readonly)
Returns the value of attribute progressions.
4 5 6 |
# File 'lib/scorecard/progressions.rb', line 4 def progressions @progressions end |
Instance Method Details
#add(identifier, amount, &block) ⇒ Object
10 11 12 |
# File 'lib/scorecard/progressions.rb', line 10 def add(identifier, amount, &block) progressions << Scorecard::Progression.new(identifier, amount, &block) end |
#clear ⇒ Object
28 29 30 |
# File 'lib/scorecard/progressions.rb', line 28 def clear progressions.clear end |
#each(&block) ⇒ Object
14 15 16 |
# File 'lib/scorecard/progressions.rb', line 14 def each(&block) progressions.each &block end |
#find(identifier) ⇒ Object
18 19 20 |
# File 'lib/scorecard/progressions.rb', line 18 def find(identifier) progressions.detect { |progression| progression.identifier == identifier } end |
#without(identifiers) ⇒ Object
22 23 24 25 26 |
# File 'lib/scorecard/progressions.rb', line 22 def without(identifiers) progressions.reject { |progression| identifiers.include?(progression.identifier) } end |