Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 381 Bytes

STRUCT.md

File metadata and controls

24 lines (18 loc) · 381 Bytes

Struct

attributes

Returns the key values of the assigned struct.

person = Struct.new(:name, :age)
person.new('bob', 60)

person.attributes #=> { name: 'bob', age: 60 }

replace

Replaces values provided within the hash.

person = Struct.new(:name, :age)
person.new('bob', 60)

person.replace(name: 'tom', age: 28)
preson.name #=> 'tom'