a = [5, 1, 6, 14, 2, 8]
b = [2, 6, 15]
a - b
# => [5, 1, 14, 8]
b - a
# => [15]
(b - a).empty?
# => false
More Related Contents:
- Uniq by object attribute in Ruby
- Boolean Validation
- Format a string containing Phone numbers
- How to understand nil vs. empty vs. blank in Ruby
- How do I get the current absolute URL in Ruby on Rails?
- SSL Error When installing rubygems, Unable to pull data from ‘https://rubygems.org/
- What is the easiest way to duplicate an activerecord record?
- How to solve error “Missing `secret_key_base` for ‘production’ environment” (Rails 4.1)
- How can I avoid running ActiveRecord callbacks?
- Rails 4: List of available datatypes
- How does instance_eval work and why does DHH hate it?
- How to create a deep copy of an object in Ruby?
- Why does String#gsub double content?
- Rails 4: before_filter vs. before_action
- How do I force RAILS_ENV in a rake task?
- Why are all Rails helpers available to all views, all the time? Is there a way to disable this?
- How to use bundler behind a proxy?
- Rails 3.1 and Ruby 1.9.3p125: ruby-debug19 still crashes with “Symbol not found: _ruby_threadptr_data_type” [duplicate]
- Best Practices for reusing code between controllers in Ruby on Rails
- How to change the default path of view files in a Rails 3 controller?
- How do I set up the database.yml file in Rails?
- Why use “self” to access ActiveRecord/Rails model properties?
- Converting string from snake_case to CamelCase in Ruby
- Converting an array of objects to ActiveRecord::Relation
- Controller spec unknown keyword: id
- Why can’t I install the SQLite gem?
- Error message: Make sure that `gem install pg -v ‘0.18.1’` succeeds before bundling
- Adding foreign key to a rails model
- RVM installed by Ruby not working?
- Rails 4.0 expire_fragment/cache expiration not working