Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Ruby – Find String for Inspection – inspect Method with Examples

inspect method returns the value as a string for the inspection. inspect is a part of Date Library in Ruby.

Syntax of inspectMmethod in Ruby

The syntax of inspect Method in Ruby Language is:

 

Parameters of inspect Method in Ruby

x – Where x is any valid date object. This parameter is required.

 

Error Handling

If the x parameter is not a valid date object inspect method returns an error.

 

Return Value of inspect Method in Ruby

inspect method will return the output in a shape of string in inspecting way.

 

Ruby – Use of inspect


Output:
Date: 2015-03-15 ((2457097j,0s,0n),+0s,2299161j)

inspect Method in Ruby


Output:

Date: 2016-10-25 ((2457687j,0s,0n),+0s,2299161j)

LearnAndLearn.com © 2018 - All rights reserved