Class: Scorecard::Progressions

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/scorecard/progressions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProgressions

Returns a new instance of Progressions.



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

def initialize
  @progressions = []
end

Instance Attribute Details

#progressionsObject (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

#clearObject



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