Skip to content

Instantly share code, notes, and snippets.

@IvanShamatov
Created May 1, 2018 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IvanShamatov/7ca4c18af6c213f45dfbf57760978e0c to your computer and use it in GitHub Desktop.
Save IvanShamatov/7ca4c18af6c213f45dfbf57760978e0c to your computer and use it in GitHub Desktop.
class User < Struct.new(:name, :age)
def to_s
"#{name}, #{age}"
end
end
=> :to_s
User.new('Ivan', 30).to_s
=> "Ivan, 30"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment