Created
June 23, 2022 12:55
-
-
Save aaripurna/ad41643e9bee1f2e28df4065a1395454 to your computer and use it in GitHub Desktop.
This is a Valid Rack Syntac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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