Represents the use of an assignment operator on a call to ‘[]`.
foo.bar[baz] += value ^^^^^^^^^^^^^^^^^^^^^
Represents the use of the ‘||=` operator on a call to `[]`.
foo.bar[baz] ||= value ^^^^^^^^^^^^^^^^^^^^^^
Represents writing to an instance variable in a context that doesn’t have an explicit value.
@foo, @bar = baz ^^^^ ^^^^
Represents a string literal that contains interpolation.
"foo #{bar} baz" ^^^^^^^^^^^^^^^^
Represents an xstring literal that contains interpolation.
`foo #{bar} baz` ^^^^^^^^^^^^^^^^
Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope, otherwise it is parsed as a method call.
foo ^^^
Represents writing to a local variable in a context that doesn’t have an explicit value.
foo, bar = baz ^^^ ^^^
Represents writing local variables using a regular expression match with named capture groups.
/(?<foo>bar)/ =~ baz ^^^^^^^^^^^^^^^^^^^^
Represents a write to a multi-target expression.
a, b, c = 1, 2, 3 ^^^^^^^^^^^^^^^^^
Represents the use of the ‘^` operator for pinning a variable in a pattern matching expression.
foo in ^bar ^^^^
Represents the use of the ‘__ENCODING__` keyword.
__ENCODING__ ^^^^^^^^^^^^
Represents a string literal, a string contained within a ‘%w` list, or plain string content within an interpolated string.
"foo" ^^^^^ %w[foo] ^^^ "foo #{bar} baz" ^^^^ ^^^^
This represents a source of Ruby code that has been parsed. It is used in conjunction with locations to allow them to resolve line numbers and source ranges.
Note: This integration is not finished, and therefore still has many inconsistencies with Ripper
. If you’d like to help out, pull requests would be greatly appreciated!
This class is meant to provide a compatibility layer between prism and Ripper
. It functions by parsing the entire tree first and then walking it and executing each of the Ripper
callbacks as it goes.
This class is going to necessarily be slower than the native Ripper
API. It is meant as a stopgap until developers migrate to using prism. It is also meant as a test harness for the prism parser.
To use this class, you treat ‘Prism::RipperCompat` effectively as you would treat the `Ripper` class.
Rinda
error base class
A RingServer
allows a Rinda::TupleSpace
to be located via UDP broadcasts. Default service location uses the following steps:
A RingServer
begins listening on the network broadcast UDP address.
A RingFinger
sends a UDP packet containing the DRb
URI
where it will listen for a reply.
The RingServer
receives the UDP packet and connects back to the provided DRb
URI
with the DRb
service.
A RingServer
requires a TupleSpace:
ts = Rinda::TupleSpace.new rs = Rinda::RingServer.new
RingServer
can also listen on multicast addresses for announcements. This allows multiple RingServers to run on the same host. To use network broadcast and multicast:
ts = Rinda::TupleSpace.new rs = Rinda::RingServer.new ts, %w[Socket::INADDR_ANY, 239.0.0.1 ff02::1]
RingFinger
is used by RingServer
clients to discover the RingServer’s TupleSpace
. Typically, all a client needs to do is call RingFinger.primary
to retrieve the remote TupleSpace
, which it can then begin using.
To find the first available remote TupleSpace:
Rinda::RingFinger.primary
To create a RingFinger
that broadcasts to a custom list:
rf = Rinda::RingFinger.new ['localhost', '192.0.2.1'] rf.primary
Rinda::RingFinger
also understands multicast addresses and sets them up properly. This allows you to run multiple RingServers on the same host:
rf = Rinda::RingFinger.new ['239.0.0.1'] rf.primary
You can set the hop count (or TTL) for multicast searches using multicast_hops
.
If you use IPv6 multicast you may need to set both an address and the outbound interface index:
rf = Rinda::RingFinger.new ['ff02::1'] rf.multicast_interface = 1 rf.primary
At this time there is no easy way to get an interface index by name.
RingProvider
uses a RingServer
advertised TupleSpace
as a name service. TupleSpace
clients can register themselves with the remote TupleSpace
and look up other provided services via the remote TupleSpace
.
Services are registered with a tuple of the format [:name, klass, DRbObject
, description].
An error that indicates we weren’t able to fetch some data from a source