-
Notifications
You must be signed in to change notification settings - Fork 152
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
:unless condition with Hash: wrong implementation and specs #150
Comments
I'd open a PR later. |
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 21, 2015
This one reaches many goals at once: - Fixes ruby-grape#56: now `exposures` is not a hash table but an array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - For ones who want previous rewriting behavior a `rewrite` option for `exposure` is introduced. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb` - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 21, 2015
This one reaches many goals at once: - Fixes ruby-grape#56: now `exposures` is not a hash table but an array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - For ones who want previous rewriting behavior a `rewrite` option for `exposure` is introduced. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb` - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 22, 2015
This one reaches many goals at once: - Fixes ruby-grape#56: now `exposures` is not a hash table but an array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - For ones who want previous rewriting behavior a `rewrite` option for `exposure` is introduced. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb` - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 23, 2015
This one reaches many goals at once: - Fixes ruby-grape#56: now `exposures` is not a hash table but an array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112 - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb` - Fixes ruby-grape#152 - Fixes ruby-grape#153 - Fixes ruby-grape#155 - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 23, 2015
This one reaches many goals at once: - Fixes ruby-grape#56: now `exposures` is not a hash table but an array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112 - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb` - Fixes ruby-grape#152 - Fixes ruby-grape#153 - Fixes ruby-grape#155 - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 24, 2015
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%. Version is bumbed to 0.5.0.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 24, 2015
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%. Version is bumbed to 0.5.0.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 24, 2015
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%. Version is bumbed to 0.5.0.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 27, 2015
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 27, 2015
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 27, 2015
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Jul 27, 2015
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
marshall-lee
added a commit
to marshall-lee/grape-entity
that referenced
this issue
Aug 2, 2015
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 15-30%.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:if
it can be used with hash likeif: { cond1: 'foo', cond2: false }
. It means that this exposure should be exposed iff all the conditions are matching. It means that it should not be exposed with options like:cond1: 'bar', cond2: false
cond1: 'foo', cond2: true
cond1: 'foo'
cond2: false
.The only valid
options
value when it's exposable iscond1: 'foo', cond: false
.Documentation says that
:unless
is an opposite of:if
. So the exposure should be exposable iff any of the conditions is not matching.And i also found a spec that tells the same idea in its text: only passes through hash :unless exposure if any attributes do not match:
If you look carefully you'll see It's wrong:
condition1: true
should be true, because it doesn't contain matchingcondition2
element.condition1: false, condition2: true
should be true becausecondition1
doesn't match.The text was updated successfully, but these errors were encountered: