2013-08-25 18:49:23 +00:00
|
|
|
class Cell
|
|
|
|
|
|
|
|
attr_reader :text, :brush
|
|
|
|
|
2013-09-16 14:24:13 +00:00
|
|
|
delegate :size, :to => :text
|
|
|
|
|
2013-08-25 18:49:23 +00:00
|
|
|
def initialize(text, brush)
|
|
|
|
@text = text
|
|
|
|
@brush = brush
|
|
|
|
end
|
|
|
|
|
|
|
|
def empty?
|
|
|
|
text.blank? && brush.default?
|
|
|
|
end
|
|
|
|
|
|
|
|
def ==(other)
|
|
|
|
text == other.text && brush == other.brush
|
|
|
|
end
|
|
|
|
|
2013-09-16 14:24:13 +00:00
|
|
|
def [](*args)
|
|
|
|
self.class.new(text[*args], brush)
|
|
|
|
end
|
|
|
|
|
2013-09-10 19:29:17 +00:00
|
|
|
def as_json(*)
|
|
|
|
[text, brush.as_json]
|
2013-08-25 18:49:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|