Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 269 Bytes

struct-without-assignment.md

File metadata and controls

19 lines (13 loc) · 269 Bytes

Struct without assignment

Struct.new("Name", :first, :last) do
  def full
    "#{first} #{last}"
  end
end

franzejr = Struct::Name.new("Franze", "Jr")
p franzejr.full

# Result:
# "Franze Jr"

View Source