Results for: "slice"

Reads lines from the stream which are separated by eol.

See also gets

Reads a line from the stream which is separated by eol.

Raises EOFError if at end of file.

No documentation available
No documentation available
No documentation available
No documentation available

Adds a separated list. The list is separated by comma with breakable space, by default.

seplist iterates the list using iter_method. It yields each object to the block given for seplist. The procedure separator_proc is called between each yields.

If the iteration is zero times, separator_proc is not called at all.

If separator_proc is nil or not given, +lambda { comma_breakable }+ is used. If iter_method is not given, :each is used.

For example, following 3 code fragments has similar effect.

q.seplist([1,2,3]) {|v| xxx v }

q.seplist([1,2,3], lambda { q.comma_breakable }, :each) {|v| xxx v }

xxx 1
q.comma_breakable
xxx 2
q.comma_breakable
xxx 3

For the given source string, return the byte offsets of every newline in the source.

Create a new AliasGlobalVariableNode node

Create a new AliasMethodNode node

Create a new BackReferenceReadNode node

Create a new FlipFlopNode node

Create a new InstanceVariableAndWriteNode node

Create a new InstanceVariableOperatorWriteNode node

Create a new InstanceVariableOrWriteNode node

Create a new InstanceVariableReadNode node

Create a new InstanceVariableTargetNode node

Create a new InstanceVariableWriteNode node

Create a new InterpolatedMatchLastLineNode node

Create a new MatchLastLineNode node

Create a new MatchPredicateNode node

Create a new NumberedReferenceReadNode node

Create a new SourceEncodingNode node

Create a new SourceFileNode node

Generate a random alphanumeric string.

The argument n specifies the length, in characters, of the alphanumeric string to be generated. The argument chars specifies the character list which the result is consist of.

If n is not specified or is nil, 16 is assumed. It may be larger in the future.

The result may contain A-Z, a-z and 0-9, unless chars is specified.

require 'random/formatter'

Random.alphanumeric     #=> "2BuBuLf3WfSKyQbR"
# or
prng = Random.new
prng.alphanumeric(10) #=> "i6K93NdqiH"

Random.alphanumeric(4, chars: [*"0".."9"]) #=> "2952"
# or
prng = Random.new
prng.alphanumeric(10, chars: [*"!".."/"]) #=> ",.,++%/''."
Search took: 5ms  ·  Total Results: 1351