ruby-grape / ruby-grape/grape-roar
Lookup Representers Dynamically
Open
Nobody has claimed this yet.
new feature
- Dominant language
- Ruby
- Stars
- 59
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Would you consider adding support for automatically extending object with the appropriate representer and releasing this as a gem?
Say something along these lines of:
def call(object, env)
representer_name = "#{object.class}Representer"
if Object.const_definied?(representer_name)
representer_class = Object.const_get()
object.extend(representer_class)
end
Grape::Formatter::Json.call object, env
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Grape::Formatter::Json.call integration and the proposed dynamic representer lookup in this repository. Done means the automatic object extension behavior is defined, tested, and the resulting change is prepared for gem release.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100