Skip to content

Instantly share code, notes, and snippets.

@bluemihai
Created March 31, 2016 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bluemihai/3b18b7a92814572de05670981852d2a0 to your computer and use it in GitHub Desktop.
Save bluemihai/3b18b7a92814572de05670981852d2a0 to your computer and use it in GitHub Desktop.
class Cell
attr_accessor :options
def initialize(position, value)
self.options = (1..9).to_a
end
# def options
# puts "running .options with @options #{}"
# @options
# end
#
# def options=(stuff)
# puts "running .options= with stuff #{stuff}"
# @options = stuff
# end
def remove_from_options(digits_array)
puts "calling remove_from_options"
puts "options is #{options}"
puts "digits_array is #{digits_array}"
return if options == []
options = options - digits_array
puts "options is #{options}"
end
end
RSpec.describe Cell do
it '#remove_from_options works' do
cell = Cell.new(14, '-')
expect(cell.options.length).to eq 9
cell.remove_from_options([5, 9])
expect(cell.options).to eq [1, 2, 3, 4, 6, 7, 8]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment