class Pangrid::Cell

solution = :black | :null | char | Rebus number = int borders = [:left, :right, :top, :bottom]

Attributes

borders[RW]
number[RW]
solution[RW]

Public Class Methods

new(**args) click to toggle source
# File lib/pangrid/xw.rb, line 36
def initialize(**args)
  args.each {|k,v| self.send :"#{k}=", v}
end

Public Instance Methods

black?() click to toggle source
# File lib/pangrid/xw.rb, line 40
def black?
  solution == :black
end
has_bar?(s) click to toggle source
# File lib/pangrid/xw.rb, line 44
def has_bar?(s)
  borders.include? s
end
inspect() click to toggle source
# File lib/pangrid/xw.rb, line 65
def inspect
  case solution
  when :black; '#'
  when :null; '.'
  when Rebus; solution.inspect
  else; solution
  end
end
rebus?() click to toggle source
# File lib/pangrid/xw.rb, line 48
def rebus?
  solution.is_a?(Rebus)
end
to_char() click to toggle source
# File lib/pangrid/xw.rb, line 52
def to_char
  rebus? ? solution.to_char : solution
end
to_w() click to toggle source
# File lib/pangrid/xw.rb, line 56
def to_w
  case solution
  when :black; '#'
  when :null; '.'
  when Rebus; solution.inspect
  else; solution
  end
end