Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | ArrayInquirer to correctly find symbols or strings | Leigh Halliday | 2015-08-28 | 1 | -1/+1 |
| | | | | | | | | | The problem existed where if your ArrayInquirer values were strings but you checked them using any? with a symbol, it would not find the value. Now it will correctly check whether both the String form or the Symbol form are included in the Array. ` | ||||
* | [skip ci] Update documentation for ArrayInquirer#any? | Anton Davydov | 2015-05-21 | 1 | -4/+10 |
| | |||||
* | Add ActiveSupport::ArrayInquirer and Array#inquiry | George Claghorn | 2015-03-24 | 1 | -0/+38 |
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its string-like contents. For example, `request.variant` returns an `ArrayInquirer` object. To check a request's variants, you can call: request.variant.phone? request.variant.any?(:phone, :tablet) ...instead of: request.variant.include?(:phone) request.variant.any? { |v| v.in?([:phone, :tablet]) } `Array#inquiry` is a shortcut for wrapping the receiving array in an `ArrayInquirer`: pets = [:cat, :dog] pets.cat? # => true pets.ferret? # => false pets.any?(:cat, :ferret} # => true |