Class: TinyTable::Cell
- Inherits:
-
Object
- Object
- TinyTable::Cell
- Defined in:
- lib/tinytable/cell.rb
Instance Attribute Summary collapse
-
#alignment ⇒ Object
readonly
Returns the value of attribute alignment.
Instance Method Summary collapse
- #==(obj) ⇒ Object
-
#initialize(text, alignment) ⇒ Cell
constructor
A new instance of Cell.
- #text ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(text, alignment) ⇒ Cell
Returns a new instance of Cell.
5 6 7 8 |
# File 'lib/tinytable/cell.rb', line 5 def initialize(text, alignment) @text = text || '' @alignment = alignment end |
Instance Attribute Details
#alignment ⇒ Object (readonly)
Returns the value of attribute alignment.
3 4 5 |
# File 'lib/tinytable/cell.rb', line 3 def alignment @alignment end |
Instance Method Details
#==(obj) ⇒ Object
10 11 12 13 14 |
# File 'lib/tinytable/cell.rb', line 10 def ==(obj) return false unless obj.is_a? Cell text == obj.text && alignment == obj.alignment end |
#text ⇒ Object
16 17 18 |
# File 'lib/tinytable/cell.rb', line 16 def text @text.to_s end |
#width ⇒ Object
20 21 22 |
# File 'lib/tinytable/cell.rb', line 20 def width text.length end |