Returns the new Hash suitable for pattern matching containing only the keys specified as an argument.
Returns the row as a CSV String
. Headers are not included:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) row = table[0] row.to_csv # => "foo,0\n"
Returns the table as CSV string. See Options for Generating.
Defaults option write_headers
to true
:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.to_csv # => "Name,Value\nfoo,0\nbar,1\nbaz,2\n"
Omits the headers if option write_headers
is given as false
(see {Option write_headers
}):
table.to_csv(write_headers: false) # => "foo,0\nbar,1\nbaz,2\n"
Limit rows if option limit
is given like 2
:
table.to_csv(limit: 2) # => "Name,Value\nfoo,0\nbar,1\n"
Returns a human readable string that contains corrections
. This formatter is designed to be less verbose to not take too much screen space while being helpful enough to the user.
@example
formatter = DidYouMean::Formatter.new # displays suggestions in two lines with the leading empty line puts formatter.message_for(["methods", "method"]) Did you mean? methods method # => nil # displays an empty line puts formatter.message_for([]) # => nil
Returns a human readable string that contains corrections
. This formatter is designed to be less verbose to not take too much screen space while being helpful enough to the user.
@example
formatter = DidYouMean::Formatter.new # displays suggestions in two lines with the leading empty line puts formatter.message_for(["methods", "method"]) Did you mean? methods method # => nil # displays an empty line puts formatter.message_for([]) # => nil
Returns a human readable string that contains corrections
. This formatter is designed to be less verbose to not take too much screen space while being helpful enough to the user.
@example
formatter = DidYouMean::Formatter.new # displays suggestions in two lines with the leading empty line puts formatter.message_for(["methods", "method"]) Did you mean? methods method # => nil # displays an empty line puts formatter.message_for([]) # => nil
Convert an object reference id to an object.
This implementation looks up the reference id in the local object space and returns the object it refers to.
Convert an object into a reference id.
This implementation returns the object’s __id__ in the local object space.
Convert a dRuby reference to the local object it refers to.
Convert a local object to a dRuby reference.
Has a method been included in the list of insecure methods?
Coerce an object to a string, providing our own representation if to_s is not defined for the object.
Convert an object reference id to an object.
This implementation looks up the reference id in the local object space and returns the object it refers to.