instance method
Range#inspect
() -> ::String
inspect → string
range.c
View on GitHub ↗
static VALUE
range_inspect(VALUE range)
{
return rb_exec_recursive(inspect_range, range, 0);
}
Returns a string representation of self, including begin.inspect and end.inspect:
Example
(1..4).inspect # => "1..4" (1...4).inspect # => "1...4" (1..).inspect # => "1.." (..4).inspect # => "..4"
Note that returns from to_s and inspect may differ:
Example
('a'..'d').to_s # => "a..d" ('a'..'d').inspect # => "\"a\"..\"d\""
Related: Range#to_s.