Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`given` will check whether attribute is declared in its scope. If not, it raises an error. ```ruby optional :a given a: ->(val) { val == 'a' } do optional :b given b: ->(val) { val == 'b' } do requires :c end end ``` In the example, `optional :a` creates a scope. `given a: ...` creates another scope, which parent scope is the one created by `optional :a`, and attributes `:b` declared in `optional :b` is pushed to parent scope. The bug here is `given b: ...` cannot find `:b` in its scope. Since the attribute `:b` is pushed to its parent scope. So, fix the code to check attribute in its parent scope if it has parent scope.
- Loading branch information