Sha256: 73cec9818d7314a666168b91b409e19759743876d3f87107c91d75b979b45f29

Contents?: true

Size: 442 Bytes

Versions: 3

Compression:

Stored size: 442 Bytes

Contents

# Structure

Turn data (e.g. API responses) into immutable value objects in Ruby.

## Usage

Mix in Structure and define values with `.value`.

```ruby
class Location
  include Structure

  attr :res

  def initialize(res)
    @res = res
  end

  value :latitude do
    res.fetch(:lat)
  end

  value :longitude do
    res.fetch(:lng)
  end
end

location = Location.new(lat: 10, lng: 100)
location.to_h # {:latitude=>10, :longitude=>100}
```

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
structure-0.26.0 README.md
structure-0.25.1 README.md
structure-0.25.0 README.md