Class: Roo::Excelx::Cell::Base
- Inherits:
-
Object
- Object
- Roo::Excelx::Cell::Base
- Extended by:
- Helpers::DefaultAttrReader
- Defined in:
- lib/roo/excelx/cell/base.rb
Instance Attribute Summary collapse
-
#cell_type ⇒ Object
readonly
Returns the value of attribute cell_type.
-
#cell_value ⇒ Object
readonly
Returns the value of attribute cell_value.
-
#value ⇒ Object
(also: #formatted_value)
Returns the value of attribute value.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#excelx_type ⇒ Object
DEPRECATED: Please use cell_type instead.
-
#excelx_value ⇒ Object
DEPRECATED: Please use cell_value instead.
- #formula? ⇒ Boolean
-
#hyperlink ⇒ Object
DEPRECATED: Please use link? instead.
-
#initialize(value, formula, excelx_type, style, link, coordinate) ⇒ Base
constructor
A new instance of Base.
-
#link ⇒ Object
DEPRECATED: Please use link? instead.
- #link? ⇒ Boolean
- #presence ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Methods included from Helpers::DefaultAttrReader
Constructor Details
#initialize(value, formula, excelx_type, style, link, coordinate) ⇒ Base
Returns a new instance of Base.
41 42 43 44 45 46 47 48 |
# File 'lib/roo/excelx/cell/base.rb', line 41 def initialize(value, formula, excelx_type, style, link, coordinate) @cell_value = value @cell_type = excelx_type if excelx_type @formula = formula if formula @style = style unless style == 1 @coordinate = coordinate @value = link ? Roo::Link.new(link, value) : value end |
Instance Attribute Details
#cell_type ⇒ Object (readonly)
Returns the value of attribute cell_type.
10 11 12 |
# File 'lib/roo/excelx/cell/base.rb', line 10 def cell_type @cell_type end |
#cell_value ⇒ Object (readonly)
Returns the value of attribute cell_value.
10 11 12 |
# File 'lib/roo/excelx/cell/base.rb', line 10 def cell_value @cell_value end |
#value ⇒ Object Also known as: formatted_value
Returns the value of attribute value.
10 11 12 |
# File 'lib/roo/excelx/cell/base.rb', line 10 def value @value end |
Instance Method Details
#excelx_type ⇒ Object
DEPRECATED: Please use cell_type instead.
93 94 95 96 |
# File 'lib/roo/excelx/cell/base.rb', line 93 def excelx_type warn '[DEPRECATION] `excelx_type` is deprecated. Please use `cell_type` instead.' cell_type end |
#excelx_value ⇒ Object
DEPRECATED: Please use cell_value instead.
87 88 89 90 |
# File 'lib/roo/excelx/cell/base.rb', line 87 def excelx_value warn '[DEPRECATION] `excelx_value` is deprecated. Please use `cell_value` instead.' cell_value end |
#formula? ⇒ Boolean
60 61 62 |
# File 'lib/roo/excelx/cell/base.rb', line 60 def formula? !!(defined?(@formula) && @formula) end |
#hyperlink ⇒ Object
DEPRECATED: Please use link? instead.
75 76 77 78 |
# File 'lib/roo/excelx/cell/base.rb', line 75 def hyperlink warn '[DEPRECATION] `hyperlink` is deprecated. Please use `link?` instead.' link? end |
#link ⇒ Object
DEPRECATED: Please use link? instead.
81 82 83 84 |
# File 'lib/roo/excelx/cell/base.rb', line 81 def link warn '[DEPRECATION] `link` is deprecated. Please use `link?` instead.' link? end |
#link? ⇒ Boolean
64 65 66 |
# File 'lib/roo/excelx/cell/base.rb', line 64 def link? Roo::Link === @value end |
#presence ⇒ Object
102 103 104 |
# File 'lib/roo/excelx/cell/base.rb', line 102 def presence empty? ? nil : self end |
#to_s ⇒ Object
70 71 72 |
# File 'lib/roo/excelx/cell/base.rb', line 70 def to_s formatted_value end |
#type ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/roo/excelx/cell/base.rb', line 50 def type if formula? :formula elsif link? :link else default_type end end |