Skip to content
instance method

Range#inspect

() -> ::String
inspect → string

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.

See also #include? #last #hash #max also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0