class Tryruby::Tutorial
Base module for level DSL
Public Class Methods
each(&block)
click to toggle source
# File lib/tryruby/tutorial.rb, line 37 def self.each(&block) levels.each(&block) end
new()
click to toggle source
# File lib/tryruby/tutorial.rb, line 12 def initialize @levels = [] self.class.each do |block| builder = LevelBuilder.new builder.instance_eval(&block) @levels << builder.level end end
Private Class Methods
level(&block)
click to toggle source
# File lib/tryruby/tutorial.rb, line 41 def self.level(&block) levels << block end
levels()
click to toggle source
# File lib/tryruby/tutorial.rb, line 45 def self.levels @levels ||= [] end
Public Instance Methods
[](i)
click to toggle source
# File lib/tryruby/tutorial.rb, line 21 def [](i) @levels[i] end
commands()
click to toggle source
# File lib/tryruby/tutorial.rb, line 33 def commands self.class::Commands end
each(&block)
click to toggle source
# File lib/tryruby/tutorial.rb, line 25 def each(&block) @levels.each(&block) end
length()
click to toggle source
# File lib/tryruby/tutorial.rb, line 29 def length @levels.length end