Class: RT::RTCell
- Inherits:
-
Object
- Object
- RT::RTCell
- Defined in:
- lib/rt/rtparser.rb
Instance Attribute Summary collapse
-
#align ⇒ Object
readonly
Returns the value of attribute align.
-
#colspan ⇒ Object
Returns the value of attribute colspan.
-
#rowspan ⇒ Object
Returns the value of attribute rowspan.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(x) ⇒ Object
-
#initialize(value, align = nil) ⇒ RTCell
constructor
A new instance of RTCell.
- #inspect ⇒ Object
Constructor Details
#initialize(value, align = nil) ⇒ RTCell
Returns a new instance of RTCell.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rt/rtparser.rb', line 8 def initialize(value, align = nil) @rowspan = @colspan = 1 @value = value @align = case align # {:left, :center :right} when :left, :center, :right align when nil if /^[+\-]?[0-9]+\.?[0-9]*/ === value :right else :left end else raise "[BUG]Illegal align type" end end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
50 51 52 |
# File 'lib/rt/rtparser.rb', line 50 def align @align end |
#colspan ⇒ Object
Returns the value of attribute colspan.
51 52 53 |
# File 'lib/rt/rtparser.rb', line 51 def colspan @colspan end |
#rowspan ⇒ Object
Returns the value of attribute rowspan.
51 52 53 |
# File 'lib/rt/rtparser.rb', line 51 def rowspan @rowspan end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
50 51 52 |
# File 'lib/rt/rtparser.rb', line 50 def value @value end |
Instance Method Details
#==(x) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/rt/rtparser.rb', line 24 def == (x) case x when self.class self.value == "" && x.value == "" || self.value == x.value && self.align == x.align else false end end |
#inspect ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rt/rtparser.rb', line 32 def inspect if value=="" "()" else a = case align when :left "l" when :center "c" when :right "r" else raise "[BUG]Illegal align type" end "#{a}(#{value})" end end |