Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Auto-detect DSL methods #17

Closed
plexus opened this issue Aug 28, 2013 · 0 comments
Closed

Auto-detect DSL methods #17

plexus opened this issue Aug 28, 2013 · 0 comments

Comments

@plexus
Copy link
Owner

plexus commented Aug 28, 2013

when you do a include Hexp in your object, that will actually delegate to including Hexp::DSL, which defines makes your object duck-type compatible with a Hexp::Node by delegating all DSL methods to #to_hexp.

Currently Hexp::DSL contains a list of methods that it should forward, and I believe it is already out of date.

I split up the API for Node into an Attributes module and a Children module that are mixed in to Node. These define the operation that work on attributes (add_class, merge_attrs, etc), versus those that work on child nodes (add_child, empty?, map_children.)

I would like Hexp::DSL to use some meta-programming to detect all methods defined in Hexp::Node::Attributes and Hexp::Node::Children, and delegate those automatically. The ones defines in Hexp::Node itself can still be manually listed, these will change less often, and we don't want to delegate all of them (initialize, to_hexp are excluded for instance).

@plexus plexus closed this as completed in bb9b485 Aug 31, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant