You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/app/models/cell.rb

29 lines
386 B
Ruby

class Cell
attr_reader :text, :brush
delegate :size, :to => :text
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]
end
end