Class: Cheat::Controllers::APIShow

Inherits:
R
  • Object
show all
Defined in:
lib/cheat/site.rb

Instance Method Summary collapse

Instance Method Details

#get(title) ⇒ Object



70
71
72
73
74
75
76
77
# File 'lib/cheat/site.rb', line 70

def get(title)
  @headers['Content-Type'] = 'text/plain'

  sheet = Sheet.detect { |s| s.title == title }
  return { 'Error!' => "Cheat sheet `#{title}' not found." }.to_yaml unless sheet

  return { sheet.title => sheet.body }.to_yaml
end