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/snapshot_fragment.rb

23 lines
321 B
Ruby

class SnapshotFragment
attr_reader :text, :brush
def initialize(text, brush)
@text = text
@brush = brush
end
def ==(other)
other.text == text && other.brush == brush
end
def crop(size)
if size >= text.size
self
else
self.class.new(text[0...size], brush)
end
end
end