https://github.com/apotonick/declarative
DSL for nested schemas.
https://github.com/apotonick/declarative
Keywords from Contributors
json-parser rack sinatra activejob activerecord mvc json-serialization xml-parser xml-serialization
Last synced: about 15 hours ago
JSON representation
Repository metadata
DSL for nested schemas.
- Host: GitHub
- URL: https://github.com/apotonick/declarative
- Owner: apotonick
- License: mit
- Created: 2015-06-25T02:38:00.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-06-24T10:14:55.000Z (6 months ago)
- Last Synced: 2025-11-02T23:11:42.424Z (about 1 month ago)
- Language: Ruby
- Size: 86.9 KB
- Stars: 22
- Watchers: 1
- Forks: 9
- Open Issues: 4
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE.txt
README.md
Declarative
DSL for nested schemas.
Overview
Declarative allows declaring nested schemas.
Installation
Add this line to your application's Gemfile:
gem 'declarative'
Declarative::Schema
Include this into a class or module to allow defining nested schemas using the popular ::property DSL.
Normally, an abstract base class will define essential configuration.
class Model
extend Declarative::Schema
def self.default_nested_class
Model
end
end
Concrete schema-users simply derive from the base class.
class Song < Model
property :id
property :artist do
property :id
property :name
end
end
This won't do anything but populate the ::definitions graph.
Song.definitions #=>
<Definition "id">
<Definition "artist" nested=..>
<Definition "id">
<Definition "name">
The nested schema will be a subclass of Model.
Song.definitions.get(:artist) #=> <Anonymous:Model definitions=..>
Overriding Nested Building
When declaring nested schemas, per default, Declarative will use its own Schema::NestedBuilder to create the nested schema composer.
Override ::nested_builder to define your own way of doing that.
class Model
extend Declarative::Schema
def self.default_nested_class
Model
end
def self.nested_builder
->(options) do
Class.new(Model) do
class_eval &options[:_block] # executes `property :name` etc. on nested, fresh class.
end
end
end
end
Features
You can automatically include modules into all nested schemas by using ::feature.
class Model
extend Declarative::Schema
feature Bla
Defaults
class Model
extend Declarative::Schema
defaults visible: true
Copyright
- Copyright (c) 2015 Nick Sutterer apotonick@gmail.com
Owner metadata
- Name: Nick Sutterer
- Login: apotonick
- Email:
- Kind: user
- Description:
- Website: http://trailblazer.to
- Location:
- Twitter:
- Company: @trailblazer
- Icon url: https://avatars.githubusercontent.com/u/10406?u=07fb57ecf10f63b322e0a4edced970d0de9a3aa0&v=4
- Repositories: 73
- Last ynced at: 2023-04-09T04:55:32.052Z
- Profile URL: https://github.com/apotonick
GitHub Events
Total
- Issue comment event: 7
- Push event: 1
- Pull request event: 1
- Fork event: 1
Last Year
- Issue comment event: 7
- Push event: 1
- Pull request event: 1
- Fork event: 1
Committers metadata
Last synced: 4 days ago
Total Commits: 107
Total Committers: 6
Avg Commits per committer: 17.833
Development Distribution Score (DDS): 0.084
Commits in past year: 2
Committers in past year: 2
Avg Commits per committer in past year: 1.0
Development Distribution Score (DDS) in past year: 0.5
| Name | Commits | |
|---|---|---|
| Nick Sutterer | a****k@g****m | 98 |
| Abinoam P. Marques Jr | a****m@g****m | 4 |
| Abdelkader Boudih | t****e@g****m | 2 |
| Zahidul Haque | i****i@g****m | 1 |
| Takashi Masuda | m****a@f****p | 1 |
| Josef Šimánek | j****k@g****m | 1 |
Committer domains:
- feedforce.jp: 1
Issue and Pull Request metadata
Last synced: 3 months ago
Total issues: 3
Total pull requests: 7
Average time to close issues: N/A
Average time to close pull requests: 29 days
Total issue authors: 3
Total pull request authors: 7
Average comments per issue: 2.0
Average comments per pull request: 3.29
Merged pull request: 5
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 1
Past year average time to close issues: N/A
Past year average time to close pull requests: 2 months
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 20.0
Past year merged pull request: 1
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- shmokmt (1)
- jamesbebbington (1)
- aldesantis (1)
Top Pull Request Authors
- simi (2)
- abinoam (1)
- terceiro (1)
- opodartho (1)
- masutaka (1)
- seuros (1)
- nageshlop (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 2
-
Total downloads:
- rubygems: 622,159,916 total
- Total docker downloads: 1,138,618,624
- Total dependent packages: 6 (may contain duplicates)
- Total dependent repositories: 26,022 (may contain duplicates)
- Total versions: 22
- Total maintainers: 2
gem.coop: declarative
DSL for nested generic schemas with inheritance and refining.
- Homepage: https://github.com/apotonick/declarative
- Documentation: http://www.rubydoc.info/gems/declarative/
- Licenses: MIT
- Latest release: 0.0.20 (published over 5 years ago)
- Last Synced: 2025-12-07T22:31:24.442Z (3 days ago)
- Versions: 11
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 311,105,014 Total
- Docker Downloads: 569,309,312
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.059%
- Downloads: 0.075%
- Docker downloads count: 0.163%
- Maintainers (2)
rubygems.org: declarative
DSL for nested generic schemas with inheritance and refining.
- Homepage: https://github.com/apotonick/declarative
- Documentation: http://www.rubydoc.info/gems/declarative/
- Licenses: MIT
- Latest release: 0.0.20 (published over 5 years ago)
- Last Synced: 2025-12-06T23:02:11.330Z (4 days ago)
- Versions: 11
- Dependent Packages: 6
- Dependent Repositories: 26,022
- Downloads: 311,054,902 Total
- Docker Downloads: 569,309,312
-
Rankings:
- Downloads: 0.085%
- Dependent repos count: 0.221%
- Docker downloads count: 0.229%
- Dependent packages count: 2.484%
- Average: 3.969%
- Forks count: 9.679%
- Stargazers count: 11.117%
- Maintainers (2)
Dependencies
- minitest >= 0 development
- minitest-line >= 0 development
- rake >= 0 development
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
Score: 26.338893598373133