Skip to content

Instantly share code, notes, and snippets.

@aaripurna
Created June 23, 2022 12:55
Show Gist options
  • Save aaripurna/ad41643e9bee1f2e28df4065a1395454 to your computer and use it in GitHub Desktop.
Save aaripurna/ad41643e9bee1f2e28df4065a1395454 to your computer and use it in GitHub Desktop.
This is a Valid Rack Syntac
# This is a valid syntax
class App
def call(env)
[200, {'Content-Type' => 'text/plain'}, ['Hello World']]
end
end
# This is a valid syntax (singleton)
class App
def self.call(env)
[200, {'Content-Type' => 'text/plain'}, ['Hello World']]
end
end
# This is a valid syntax (lambda 1)
app = ->(env) { [200, {'Content-Type' => 'text/plain'}, ['Hello World']] }
# This is a valid syntax (lambda 2)
app = lamda { |env| [200, {'Content-Type' => 'text/plain'}, ['Hello World']] }
# This is a valid syntax (proc)
app = Proc.new do |env|
[200, {'Content-Type' => 'text/plain'}, ['Hello World']]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment