Class: Tryruby::ChallengeBuilder

Inherits:
Object
  • Object
show all
Includes:
Colors
Defined in:
lib/tryruby/challenge_builder.rb

Overview

Single challenge level builder

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Colors

paint, tryruby

Constructor Details

#initializeChallengeBuilder



13
14
15
16
17
18
# File 'lib/tryruby/challenge_builder.rb', line 13

def initialize
  @help = ''
  @test = nil
  @setup = nil
  @display_setup = false
end

Instance Attribute Details

#display_setup=(value) ⇒ Object (writeonly) Also known as: display_setup

Sets the attribute display_setup



9
10
11
# File 'lib/tryruby/challenge_builder.rb', line 9

def display_setup=(value)
  @display_setup = value
end

#help=(value) ⇒ Object (writeonly) Also known as: help

Sets the attribute help



9
10
11
# File 'lib/tryruby/challenge_builder.rb', line 9

def help=(value)
  @help = value
end

#setup(&block) ⇒ Object



24
25
26
# File 'lib/tryruby/challenge_builder.rb', line 24

def setup(&block)
  self.setup = block
end

#test(&block) ⇒ Object



20
21
22
# File 'lib/tryruby/challenge_builder.rb', line 20

def test(&block)
  self.test = block
end

Instance Method Details

#challengeObject



28
29
30
# File 'lib/tryruby/challenge_builder.rb', line 28

def challenge
  Challenge.new(@help, @test, @setup, @display_setup)
end