Sha256: 7001074321241636484cb55b840f3da53ce9ca4f40d55780a4521dd97bcac56a

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

# Traits

Traits allow you to group cloner declarations together and then apply them (like in [`factory_bot`](https://github.com/thoughtbot/factory_bot)):

```ruby
class UserCloner < Clowne::Cloner
  trait :with_posts do
    include_association :posts
  end

  trait :with_profile do
    include_association :profile
  end

  trait :nullify_name do
    nullify :name
  end
end

UserCloner.call(user, traits: %i[with_posts with_profile nullify_name])
# or
UserCloner.call(user, traits: :nullify_name)
# or
# ...
```

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clowne-1.4.0 docs/traits.md
clowne-1.3.0 docs/traits.md
clowne-1.2.0 docs/traits.md