Class: Roo::Excelx::Cell
- Inherits:
-
Object
- Object
- Roo::Excelx::Cell
- Defined in:
- lib/roo/excelx/cell.rb,
lib/roo/excelx/cell/base.rb,
lib/roo/excelx/cell/date.rb,
lib/roo/excelx/cell/time.rb,
lib/roo/excelx/cell/empty.rb,
lib/roo/excelx/cell/number.rb,
lib/roo/excelx/cell/string.rb,
lib/roo/excelx/cell/boolean.rb,
lib/roo/excelx/cell/datetime.rb
Defined Under Namespace
Classes: Base, Boolean, Coordinate, Date, DateTime, Empty, Number, String, Time
Instance Attribute Summary collapse
-
#coordinate ⇒ Object
readonly
Returns the value of attribute coordinate.
-
#excelx_type ⇒ Object
readonly
Returns the value of attribute excelx_type.
-
#excelx_value ⇒ Object
readonly
Returns the value of attribute excelx_value.
-
#formula ⇒ Object
readonly
Returns the value of attribute formula.
-
#hyperlink ⇒ Object
readonly
Returns the value of attribute hyperlink.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value, type, formula, excelx_type, excelx_value, style, hyperlink, base_date, coordinate) ⇒ Cell
constructor
DEPRECATED: Please use Cell.create_cell instead.
- #type ⇒ Object
Constructor Details
#initialize(value, type, formula, excelx_type, excelx_value, style, hyperlink, base_date, coordinate) ⇒ Cell
DEPRECATED: Please use Cell.create_cell instead.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/roo/excelx/cell.rb', line 18 def initialize(value, type, formula, excelx_type, excelx_value, style, hyperlink, base_date, coordinate) warn '[DEPRECATION] `Cell.new` is deprecated. Please use `Cell.create_cell` instead.' @type = type @formula = formula @base_date = base_date if [:date, :datetime].include?(@type) @excelx_type = excelx_type @excelx_value = excelx_value @style = style @value = type_cast_value(value) @value = Roo::Link.new(hyperlink, @value.to_s) if hyperlink @coordinate = coordinate end |
Instance Attribute Details
#coordinate ⇒ Object (readonly)
Returns the value of attribute coordinate.
14 15 16 |
# File 'lib/roo/excelx/cell.rb', line 14 def coordinate @coordinate end |
#excelx_type ⇒ Object (readonly)
Returns the value of attribute excelx_type.
14 15 16 |
# File 'lib/roo/excelx/cell.rb', line 14 def excelx_type @excelx_type end |
#excelx_value ⇒ Object (readonly)
Returns the value of attribute excelx_value.
14 15 16 |
# File 'lib/roo/excelx/cell.rb', line 14 def excelx_value @excelx_value end |
#formula ⇒ Object (readonly)
Returns the value of attribute formula.
14 15 16 |
# File 'lib/roo/excelx/cell.rb', line 14 def formula @formula end |
#hyperlink ⇒ Object (readonly)
Returns the value of attribute hyperlink.
14 15 16 |
# File 'lib/roo/excelx/cell.rb', line 14 def hyperlink @hyperlink end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
14 15 16 |
# File 'lib/roo/excelx/cell.rb', line 14 def style @style end |
#value ⇒ Object
Returns the value of attribute value.
14 15 16 |
# File 'lib/roo/excelx/cell.rb', line 14 def value @value end |
Class Method Details
.cell_class(type) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/roo/excelx/cell.rb', line 46 def self.cell_class(type) case type when :string Cell::String when :boolean Cell::Boolean when :number Cell::Number when :date Cell::Date when :datetime Cell::DateTime when :time Cell::Time end end |
.create_cell(type, *values) ⇒ Object
42 43 44 |
# File 'lib/roo/excelx/cell.rb', line 42 def self.create_cell(type, *values) cell_class(type)&.new(*values) end |