Project
Reverse Dependencies for treetop
The projects listed here declare treetop as a runtime or development dependency
0.0
Todoist implements its filter and query language client side, this Gem reimplements the language features against Todoist's REST API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
Parse the TOML specificatin
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Rena is a Ruby library for manipulating RDF files.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
File translation and conversion utility
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
A simple vcard parser using Treetop
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Easy to use parser for Debian Control Files.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
# Trope
**[Documentation][docs] - [Gem][gems] - [Source][source]**
Prototyping language that transcompiles into pure Ruby code.
1. Build your concept in Trope.
2. Write specs.
3. Transcompile into Ruby.
4. Destroy Trope files.
5. Red, green, refactor.
## Install
> NOTE: Trope is not released yet, the gem is just a placeholder.
### Bundler: `gem 'trope'`
### RubyGems: `gem install trope`
## Example
Create `library.trope`:
```ruby
object Book
attr name <String> -!wd 'Unnamed book'
attr isbn <Integer> -w
attr library <Library> -w do
before write { @library.books.delete(self) unless @library.nil? }
after write { @library.books.push(self) unless @library.books.include?(self) }
end
end
object Library
attr books <Array> -d Array.new
meth add_book do |attributes_or_book <Hash, Book>|
book = attributes_or_book.is_a?(Book) ? attributes_or_book : Book.new(attributes_or_book)
book.library = self
@books << book
end
end
```
Now generate the Ruby code:
```sh
$ trope compile libary.trope
```
Those 15 lines will be transcompiled into the following pure Ruby code in `library.rb`:
```ruby
class Book
class Error < RuntimeError; end
class InvalidAttributesError < Error
def to_s
'attributes must be a Hash or respond to #to_h'
end
end
class MissingAttributeError < Error
def initialize(attr_name, attr_class)
@name, @class = attr_name.to_s, attr_class.to_s
end
def to_s
"attribute '#@name' does not exist for #@class"
end
end
class MissingNameError < Error
def to_s
'name cannot be nil'
end
end
class InvalidNameError < Error
def to_s
'name must be an instance of String or respond to :to_s'
end
end
class InvalidIsbnError < Error
def to_s
'isbn must be an instance of Integer or respond to :to_i'
end
end
class MissingLibraryError < Error
def to_s
'library cannot be nil'
end
end
class InvalidLibraryError < Error
def to_s
'library must be an instance of Library'
end
end
attr_reader *(@@_attributes = [:name, :isbn, :library])
def initialize(attributes={})
raise InvalidAttributesError unless attributes.is_a?(Hash) || attributes.respond_to?(:to_h)
attributes = attributes.to_h unless attributes.is_a?(Hash)
raise MissingNameError if attributes.has_key?(:name) && attributes[:name].nil?
attributes[:name] = 'Unnamed book' unless attributes.has_key?(:name)
attributes.each do |name, value|
raise MissingAttributeError.new(name, self.class) unless @@_attributes.include?(name.to_sym)
setter_method = "#{name}="
setter_method = "_#{setter_method}" unless self.class.method_defined?(setter_method)
send(setter_method, value)
end
end
def name=(value)
raise MissingNameError if value.nil?
raise InvalidNameError unless value.is_a?(String) || value.respond_to?(:to_s)
value = value.to_i unless value.is_a?(Integer)
@name = value
end
def isbn=(value)
raise InvalidIsbnError unless value.is_a?(Integer) || value.respond_to?(:to_i)
value = value.to_i unless value.is_a?(Integer)
@isbn = value
end
def library=(value)
raise InvalidLibraryError unless value.is_a?(Library) || value.nil?
@library.books.delete(self) unless @library.nil?
@library = value
@library.books.push(self) unless @library.books.include?(self)
@library
end
end
class Library
class Error < RuntimeError; end
class InvalidAttributesError < Error
def to_s
'attributes must be an instance of Hash or respond to #to_h'
end
end
class MissingAttributeError < Error
def initialize(attr_name, attr_class)
@name, @class = attr_name.to_s, attr_class.to_s
end
def to_s
"attribute '#@name' does not exist for #@class"
end
end
class InvalidBooksError < Error
def to_s
'books must be an instance of Array or respond to #to_a'
end
end
attr_reader *(@@_attributes = [:books])
def initialize(attributes={})
raise InvalidAttributesError unless attributes.is_a?(Hash) || attributes.respond_to?(:to_h)
attributes = attributes.to_h unless attributes.is_a?(Hash)
attributes[:books] = Array.new unless attributes.has_key?(:books)
attributes.each do |name, value|
raise MissingAttributeError.new(name, self.class) unless @@_attributes.include?(name.to_sym)
setter_method = "#{name}="
setter_method = "_#{setter_method}" unless self.class.method_defined?(setter_method)
send(setter_method, value)
end
end
def add_book(attributes_or_book={})
raise InvalidAttributesError unless attributes_or_book.is_a?(Hash) || attributes_or_book.respond_to?(:to_h) || attributes_or_book.is_a?(Book)
attributes_or_book = attributes_or_book.to_h unless attributes_or_book.is_a?(Hash) || attributes_or_book.is_a?(Book)
book = attributes_or_book.is_a?(Book) ? attributes_or_book : Book.new(attributes_or_book)
book.library = self
@books << book
end
protected
def _books=(value)
raise InvalidBooksError unless value.is_a?(Array) || value.respond_to?(:to_a)
value = value.to_a unless value.is_a?(Array)
@books = value
end
end
```
Using the transcompiled Ruby code will produce the expected results:
```ruby
p library = Library.new # => #<Library:0x007fc55c0ce418 @books=[]>
p library.add_book name: 'Book 1', isbn: 1 # => [#<Book:0x007fc55c0cde78 @name=0, @isbn=1, @library=#<Library:0x007fc55c0ce418 @books=[...]>>]
p library # => #<Library:0x007fc55c0ce418 @books=[#<Book:0x007fc55c0cde78 @name=0, @isbn=1, @library=#<Library:0x007fc55c0ce418 ...>>]>
p library.books.first # => #<Book:0x007fc55c0cde78 @name=0, @isbn=1, @library=#<Library:0x007fc55c0ce418 @books=[#<Book:0x007fc55c0cde78 ...>]>>
p library.books.first.isbn = nil # => nil
p library.books.first.name = nil # => Book::MissingNameError: name cannot be nil
p library.books.first.library = nil # => Book::MissingLibraryError: library cannot be nil
p library.books.first.isbn = ['array'] # => Book::InvalidIsbnError: isbn must be an instance of Integer or respond to :to_i
p library = Library.new(books: 123) # => Library::InvalidBooksError: books must be an instance of Array or respond to #to_a
```
### Breakdown
```ruby
object Book
attr name <String> -!wd 'Unnamed book'
end
```
This says that I have an object `Book` that has an attribute `name` (`attr name`) that
must either be an instance/subclass of `String` or be able to convert to an instance of
`String` using `#to_s` (`<String>`). It is a required attribute that can never be set to nil (`!`), has a writer method (`w`),
and defaults to 'Unnamed book'.
The minus sign (`-`) indicates a 'switch' or 'option', must like most *nix command line
programs. The example could also have been written like so:
```ruby
object Book
attr name <String> -! -w -d 'Unnamed book'
end
```
The above examples will transcompile into the following:
```ruby
class Book
class Error < RuntimeError; end
class InvalidAttributesError < Error
def to_s
'attributes must be a Hash or respond to #to_h'
end
end
class MissingAttributeError < Error
def initialize(attr_name, attr_class)
@name, @class = attr_name.to_s, attr_class.to_s
end
def to_s
"attribute '#@name' does not exist for #@class"
end
end
class MissingNameError < Error
def to_s
'name cannot be nil'
end
end
class InvalidNameError < Error
def to_s
'name must be an instance of String or respond to :to_s'
end
end
attr_reader *(@@_attributes = [:name])
@@_required_attributes = [:name]
def initialize(attributes={})
raise InvalidAttributesError unless attributes.is_a?(Hash) || attributes.respond_to?(:to_h)
attributes = attributes.to_h unless attributes.is_a?(Hash)
raise MissingNameError if attributes.has_key?(:name) && attributes[:name].nil?
attributes[:name] = 'Unnamed book' unless attributes.has_key?(:name)
attributes.each do |name, value|
raise MissingAttributeError.new(name, self.class) unless @@_attributes.include?(name.to_sym)
setter_method = "#{name}="
setter_method = "_#{setter_method}" unless self.class.method_defined?(setter_method)
send(setter_method, value)
end
end
def name=(value)
raise MissingNameError if value.nil?
raise InvalidNameError unless value.is_a?(String) || value.respond_to?(:to_s)
value = value.to_i unless value.is_a?(Integer)
@name = value
end
end
```
## Contributing
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, VERSION, or Gemfile. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
## Copyright
Copyright © 2012 Ryan Scott Lewis <ryan@rynet.us>.
The MIT License (MIT) - See LICENSE for further details.
[docs]: http://rubydoc.info/gems/trope/frames
[gems]: https://rubygems.org/gems/trope
[source]: https://github.com/RyanScottLewis/trope
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
A specced little language written with ruby and treetop. It has lambdas, recursion, conditionals, arrays, hashes, ranges, strings, arithmetics and some other stuff. It even has a small code import facility.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
Extract content from tweets
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
LESS is leaner CSS
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
gem install universe-parsing
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
A Ragios plugin that uses a real web browser to monitor transactions on a website for availability
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
A gem to generate user cases in UML using dot
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
See README at https://github.com/skadistats/vdf4r
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
Backup is a RubyGem, written for UNIX-like operating systems, that allows you to easily perform backup operations on both your remote and local environments. It provides you with an elegant DSL in Ruby for modeling your backups. Backup has built-in support for various databases, storage protocols/services, syncers, compressors, encryptors and notifiers which you can mix and match. It was built with modularity, extensibility and simplicity in mind.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
Resume generation and writing tools
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Provides treetop grammar for Vertica SQL. (Most likely works with Postgres SQL as well)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Translates where-like filter syntax into an Arel-based ActiveRecord scope,
so you can safely use SQL syntax in Rails controller parameters.
What it lacks in power, it gains in simplicity and ease of use for API consumers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024