Class: ToSymDrill

Inherits:
Drill
  • Object
show all
Defined in:
lib/ruby_drills/string/to_sym_drill.rb

Constant Summary

Constants included from Commands

Commands::GAMBLER

Instance Attribute Summary

Attributes inherited from Drill

#hints, #next, #previous

Instance Method Summary collapse

Methods inherited from Drill

#done?, #drills, #expected, #initialize, #non!

Methods included from Commands

#back, #clear, #continue, #fail, #fold, #help, #hint, #quit, #review, #skip, #welcome, #win

Constructor Details

This class inherits a constructor from Drill

Instance Method Details

#referenceObject



17
18
19
# File 'lib/ruby_drills/string/to_sym_drill.rb', line 17

def reference
  "@value.to_sym"
end

#setupObject



3
4
5
6
# File 'lib/ruby_drills/string/to_sym_drill.rb', line 3

def setup
  @value = %{mouse}
  @hints = ["http://www.ruby-doc.org/core-1.9.3/String.html#method-i-to_sym"]
end

#showObject



8
9
10
11
12
13
14
15
# File 'lib/ruby_drills/string/to_sym_drill.rb', line 8

def show
  puts %{
@value = #{@value.inspect}

Take this string and turn it into a symbol. The output should be
#{expected.inspect}:
}
end

#valid?(input) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/ruby_drills/string/to_sym_drill.rb', line 21

def valid?(input)
  input.include?("to_sym")
end