Class: Tryruby::Level

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/tryruby/level.rb

Overview

Single tutorial level

Instance Method Summary collapse

Constructor Details

#initialize(*challenges) ⇒ Level

Returns a new instance of Level.



6
7
8
# File 'lib/tryruby/level.rb', line 6

def initialize(*challenges)
  @challenges = challenges
end

Instance Method Details

#[](n) ⇒ Object



10
11
12
# File 'lib/tryruby/level.rb', line 10

def [](n)
  @challenges[n]
end

#each(&block) ⇒ Object



14
15
16
# File 'lib/tryruby/level.rb', line 14

def each(&block)
  @challenges.each(&block)
end

#lengthObject

Number of challenges in level



19
20
21
# File 'lib/tryruby/level.rb', line 19

def length
  @challenges.length
end