Sha256: db6759b37d3610e29a2efbad678c0fcb472a4a302e1286fcbf597b81c72d5db4

Contents?: true

Size: 742 Bytes

Versions: 8

Compression:

Stored size: 742 Bytes

Contents

# Struct

`[]`
------
Access a value in the Struct by key, like a Hash.

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

person['name'] #=> 'bob'
person['fake'] #=> nil
```

`[]=`
------
Store a value in the Struct by key, like a Hash.

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

person['name'] = 'tim'

person['name'] #=> 'tim'
```

`attributes`
------
Returns the key values of the assigned struct.

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

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

`replace`
------
Replaces values provided within the hash.

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lite-ruby-1.3.0 docs/STRUCT.md
lite-ruby-1.2.0 docs/STRUCT.md
lite-ruby-1.1.15 docs/STRUCT.md
lite-ruby-1.1.14 docs/STRUCT.md
lite-ruby-1.1.13 docs/STRUCT.md
lite-ruby-1.1.12 docs/STRUCT.md
lite-ruby-1.1.11 docs/STRUCT.md
lite-ruby-1.1.10 docs/STRUCT.md