Basic Introspection
Adds .description to Curly::Presenter, as well as .presenter_for?. Noice. Fixes #105.
{
components: [
{ name: "midget",
type: "value",
attributes: [],
identifier: nil,
block: false },
{ name: "clown",
type: "value",
attributes: [],
identifier: nil,
block: false },
{ name: "elephant",
type: "value",
attributes: [],
identifier: nil,
block: false },
{ name: "alpha",
type: "value",
attributes: [
{ name: "age", required: false }],
identifier: { name: "name", required: true },
block: false },
{ name: "beta",
type: "value",
attributes: [
{ name: "test", required: true },
{ name: "this", required: false }],
identifier: nil,
block: false },
{ name: "charlie",
type: "value",
attributes: [],
identifier: nil,
block: "test" },
{ name: "delta?",
type: "conditional",
attributes: [],
identifier: nil,
block: false },
{ name: "cats",
type: "collection",
attributes: [],
identifier: nil,
block: false },
{ name: "monkey",
type: "context",
attributes: [],
identifier: nil,
block: false }
]
}
:heart:
A few comments:
- Parameters are called attributes in the Curly nomenclature, and they're always keyword based.
- The one positional argument a component may have is the identifier. These should appear separately in the output.
- Should the output include recursive descriptions of context and collection blocks? Maybe that's a bad idea, since you don't always want it, and there could be circular references.
Yeah, I'd say instead of that just put the class name and have the developer get that information if they want to.
I'd rather keep the output at one conceptual level – either use the Curly lingo (components, identifiers, attributes, ...) or the Ruby lingo (methods, arguments, classes).
Modified the output to separate parameters into keywords, identifier, and block.
That should be it, let me know if there's anything that needs fixing.
Thanks! We've in the process of adding stuff related to this to our product, so I'll probably wait with merging until we've verified that the format is useful. Is it okay if I add commits to this branch if need be?
Yes; let me know if there is anything I need to do.