Class: Cell
- Inherits:
-
Object
- Object
- Cell
- Defined in:
- lib/asciinema/cell.rb
Instance Attribute Summary collapse
-
#brush ⇒ Object
readonly
Returns the value of attribute brush.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](*args) ⇒ Object
- #as_json ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(text, brush) ⇒ Cell
constructor
A new instance of Cell.
- #to_f ⇒ Object
Constructor Details
#initialize(text, brush) ⇒ Cell
Returns a new instance of Cell.
9 10 11 12 |
# File 'lib/asciinema/cell.rb', line 9 def initialize(text, brush) @text = text @brush = brush end |
Instance Attribute Details
#brush ⇒ Object (readonly)
Returns the value of attribute brush.
5 6 7 |
# File 'lib/asciinema/cell.rb', line 5 def brush @brush end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/asciinema/cell.rb', line 5 def text @text end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 |
# File 'lib/asciinema/cell.rb', line 18 def ==(other) text == other.text && brush == other.brush end |
#[](*args) ⇒ Object
22 23 24 |
# File 'lib/asciinema/cell.rb', line 22 def [](*args) self.class.new(text[*args], brush) end |
#as_json ⇒ Object
26 27 28 |
# File 'lib/asciinema/cell.rb', line 26 def as_json(*) [text, brush.as_json] end |
#empty? ⇒ Boolean
14 15 16 |
# File 'lib/asciinema/cell.rb', line 14 def empty? text.blank? && brush.default? end |
#to_f ⇒ Object
30 31 32 |
# File 'lib/asciinema/cell.rb', line 30 def to_f size end |