Class: SmashRuby::Phase

Inherits:
Object
  • Object
show all
Defined in:
lib/smash_ruby/phase.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phase_hash) ⇒ Phase

Returns a new instance of Phase.



6
7
8
9
# File 'lib/smash_ruby/phase.rb', line 6

def initialize(phase_hash)
  @id = phase_hash.dig('id')
  @name = phase_hash.dig('name')
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/smash_ruby/phase.rb', line 4

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/smash_ruby/phase.rb', line 4

def name
  @name
end

#poolsObject (readonly)

Returns the value of attribute pools.



4
5
6
# File 'lib/smash_ruby/phase.rb', line 4

def pools
  @pools
end

#resultsObject (readonly)

Returns the value of attribute results.



4
5
6
# File 'lib/smash_ruby/phase.rb', line 4

def results
  @results
end

Instance Method Details

#build_pools(groups) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/smash_ruby/phase.rb', line 11

def build_pools(groups)
  @pools ||= []

  if name.include? 'Pool'
    groups.each do |group|
      if group.dig('phaseId') == id
        @pools << SmashRuby::Pool.new(group)
      end
    end
  end
end