Class: IncludeDrill

Inherits:
Drill
  • Object
show all
Defined in:
lib/ruby_drills/string/include_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



19
20
21
# File 'lib/ruby_drills/string/include_drill.rb', line 19

def reference
  "@message.include?('hello')"
end

#setupObject



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

def setup
  @message = "hjwotrubjof15joe7;q;j8eldjowj234nfinskpaohello2j\ndilenudbjsinfjubfhbjisnkfnbfurbrofbdj92"
  @hints = ["What's another way to state that something is comprised of another thing?"]
end

#showObject



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

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

Find out if this cryptic string contains the string 'hello'.

Use the method that will return true or false depending on if the string 'hello'
is in @message:
}
end

#valid?(input) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/ruby_drills/string/include_drill.rb', line 23

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