Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oleander/dry-interface
https://github.com/oleander/dry-interface
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/oleander/dry-interface
- Owner: oleander
- License: mit
- Created: 2021-11-21T03:43:53.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-16T00:41:24.000Z (about 3 years ago)
- Last Synced: 2024-11-06T13:50:17.409Z (3 months ago)
- Language: Ruby
- Size: 37.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Dry::Interface [![Main](https://github.com/oleander/dry-interface/actions/workflows/main.yml/badge.svg)](https://github.com/oleander/dry-interface/actions/workflows/main.yml)
``` ruby
require "dry/interface"class Animal < Dry::Interface
class Mammal < Concrete
attribute :id, Value(:mammal)
endclass Bird < Value
attribute :id, Value(:bird)
endclass Fish < Abstract
class Whale < Value
attribute :id, Value(:whale)
endclass Shark < Value
attribute :id, Value(:shark)
end
end
endAnimal.new(id: :mammal) # => Animal::Mammal
Animal.new(id: :shark) # => Animal::Fish::Shark
```