asciinema.org/app/models/cell.rb

29 lines
386 B
Ruby
Raw Normal View History

2013-08-25 18:49:23 +00:00
class Cell
attr_reader :text, :brush
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
def [](*args)
self.class.new(text[*args], brush)
end
def as_json(*)
[text, brush.as_json]
2013-08-25 18:49:23 +00:00
end
end