Class: OoxmlParser::Formula
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Formula
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb
Overview
Class for parsing ‘formulas` <f>
Instance Attribute Summary collapse
-
#reference ⇒ Coordinates
readonly
Reference coordinates.
-
#string_index ⇒ StringIndex
readonly
String index.
-
#type ⇒ String
readonly
Type.
-
#value ⇒ String
readonly
Value.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#empty? ⇒ True, False
Check if formula empty.
-
#parse(node) ⇒ Formula
Parse Formula object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#reference ⇒ Coordinates (readonly)
Returns reference coordinates.
7 8 9 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb', line 7 def reference @reference end |
#string_index ⇒ StringIndex (readonly)
Returns string index.
9 10 11 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb', line 9 def string_index @string_index end |
#type ⇒ String (readonly)
Returns type.
11 12 13 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb', line 11 def type @type end |
#value ⇒ String (readonly)
Returns value.
13 14 15 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb', line 13 def value @value end |
Instance Method Details
#empty? ⇒ True, False
Returns check if formula empty.
35 36 37 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb', line 35 def empty? !(reference || string_index || type || value) end |
#parse(node) ⇒ Formula
Parse Formula object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb', line 18 def parse(node) node.attributes.each do |key, value| case key when 'ref' @reference = Coordinates.parser_coordinates_range(value.value.to_s) when 'si' @string_index = value.value.to_i when 't' @type = value.value.to_s end end @value = node.text unless node.text.empty? self end |