Ruby on Rails Monday, February 26, 2018

On 21 February 2018 at 19:35, Abdel Latif <mlotfi2005@gmail.com> wrote:
> Hi,
>
> I would like to find a way to tell me if an array has only some items but
> not others, for example :
>
> employment_status = ['Hired','Hired','Provisionally
> Hired','Hired','Hired','Provisionally Hired','Hired','Provisionally
> Hired','Hired']
>
> I want to test this array to see if it contains only :
> Hired
> or
> Provisionally Hired
> or both

Array.include? might be what you are looking for.

Colin

>
> but not any other string.
>
> Thanks,
> your help is appreciated.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/3e342669-ada4-4b38-b47a-56ff58912e6d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsBytQnifRi_Q9rpN5QYvjwUOgKKsK7E6sjvn-0%2Bnh0hQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment