https://github.com/chip/dieselnote
A basic internal DSL in Ruby for managing a Music Catalog
https://github.com/chip/dieselnote
Last synced: about 2 months ago
JSON representation
A basic internal DSL in Ruby for managing a Music Catalog
- Host: GitHub
- URL: https://github.com/chip/dieselnote
- Owner: chip
- License: other
- Created: 2014-12-03T23:22:47.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-01-27T19:25:08.000Z (over 13 years ago)
- Last Synced: 2025-04-30T10:33:37.632Z (about 1 year ago)
- Language: Ruby
- Size: 133 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DieselNote
=======
This is a simple proof of concept Ruby internal DSL. It combines ideas and examples found in CodeSchool's Ruby Bits 2, Metaprogramming Ruby, Destroy All Software, Practicing Ruby, and various other places.
The goal was to make a small DSL in Ruby for adding and displaying song information.
Usage
-----
```
require 'diesel_note'
song('Dear Prudence') { {artist: 'The Beatles', album: 'The White Album'} }
find_artist('The Beatles') { puts show_info }
```
Dynamic Attributes
------------------
A song requires a Title at minimum, but any other attribute can be added dynamically.
Dynamic Finder
--------------
Similar to ActiveRecord, DieselNote supports dynamic #find methods for any previously defined attribute.
```
find_artist('The Beatles') { puts show_info }
find_title('The White Album') { puts show_info }