Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unexpose Method #109

Merged
merged 1 commit into from
Mar 9, 2015
Merged

Add Unexpose Method #109

merged 1 commit into from
Mar 9, 2015

Conversation

jonmchan
Copy link
Contributor

@jonmchan jonmchan commented Mar 5, 2015

Add a method to unexpose an attribute.

Scenario for use:

You wish to inherit from a Grape::Entity that has more parameters exposed than the child entity should have exposed, you can simply inherit from the parent and unexpose the parameters that you don't want exposed.

Example:

class UserData < Grape::Entity
  expose :name
  expose :address1
  expose :address2
  expose :address_state
  expose :address_city
  expose :email
  expose :phone
end

class MailingAddress < UserData
  unexpose :email
  unexpose :phone
end

@dblock
Copy link
Member

dblock commented Mar 6, 2015

I like it. It needs a CHANGELOG and README update, please.

@jonmchan
Copy link
Contributor Author

jonmchan commented Mar 6, 2015

@dblock CHANGELOG and README updated.

dblock added a commit that referenced this pull request Mar 9, 2015
@dblock dblock merged commit dce9d9a into ruby-grape:master Mar 9, 2015
@dblock
Copy link
Member

dblock commented Mar 9, 2015

Merged, thanks.

@jonmchan jonmchan deleted the unexpose branch March 11, 2015 05:02
@jonmchan
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants