Class: PrettyIRB::CheatSheet

Inherits:
Object
  • Object
show all
Defined in:
lib/pretty_irb/cheat_sheet.rb

Class Method Summary collapse

Class Method Details

.show(topic = nil) ⇒ Object

Get Ruby cheat sheet



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pretty_irb/cheat_sheet.rb', line 5

def show(topic = nil)
  return general_cheatsheet if topic.nil?

  case topic.downcase
  when "array"
    array_cheatsheet
  when "hash"
    hash_cheatsheet
  when "string"
    string_cheatsheet
  when "enumerable"
    enumerable_cheatsheet
  when "file"
    file_cheatsheet
  when "regex"
    regex_cheatsheet
  when "date"
    date_cheatsheet
  else
    "Unknown topic. Available: array, hash, string, enumerable, file, regex, date"
  end
end