Response class for Moved Permanently
responses (status code 301).
The Moved Permanently
response indicates that links or records returning this response should be updated to use the given URL.
References:
Response class for Found
responses (status code 302).
The Found
response indicates that the client should look at (browse to) another URL.
References:
Response class for Method Not Allowed
responses (status code 405).
The request method is not supported for the requested resource.
References:
Response class for Not Acceptable
responses (status code 406).
The requested resource is capable of generating only content that not acceptable according to the Accept headers sent in the request.
References:
Response class for Length Required
responses (status code 411).
The request did not specify the length of its content, which is required by the requested resource.
References:
Raises when there is an argument for a switch which takes no argument.
PrettyPrint::SingleLine
is used by PrettyPrint.singleline_format
It is passed to be similar to a PrettyPrint
object itself, by responding to:
but instead, the output has no line breaks
A compiler is a visitor that returns the value of each node as it visits. This is as opposed to a visitor which will only walk the tree. This can be useful when you are trying to compile a tree into a different format.
For example, to build a representation of the tree as s-expressions, you could write:
class SExpressions < Prism::Compiler def visit_arguments_node(node) = [:arguments, super] def visit_call_node(node) = [:call, super] def visit_integer_node(node) = [:integer] def visit_program_node(node) = [:program, super] end Prism.parse("1 + 2").value.accept(SExpressions.new) # => [:program, [[[:call, [[:integer], [:arguments, [[:integer]]]]]]]]
DesugarCompiler
is a compiler that desugars Ruby code into a more primitive form. This is useful for consumers that want to deal with fewer node types.
This represents a node in the tree. It is the parent class of all of the various node types.
Represents the use of the ‘&&` operator or the `and` keyword.
left and right ^^^^^^^^^^^^^^
Represents a set of arguments to a method or a keyword.
return foo, bar, baz ^^^^^^^^^^^^^
Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.
[1, 2, 3] ^^^^^^^^^
Represents an array pattern in pattern matching.
foo in 1, 2 ^^^^^^^^^^^ foo in [1, 2] ^^^^^^^^^^^^^ foo in *1 ^^^^^^^^^ foo in Bar[] ^^^^^^^^^^^^ foo in Bar[1, 2, 3] ^^^^^^^^^^^^^^^^^^^
Represents a block parameter to a method, block, or lambda definition.
def a(&b) ^^ end