Class: OOXML::Excel::Sheet::Row::Cell
- Inherits:
-
Object
- Object
- OOXML::Excel::Sheet::Row::Cell
- Defined in:
- lib/ooxml_excel/sheet.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#s ⇒ Object
Returns the value of attribute s.
-
#shared_strings ⇒ Object
Returns the value of attribute shared_strings.
-
#t ⇒ Object
Returns the value of attribute t.
-
#v ⇒ Object
Returns the value of attribute v.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ Cell
constructor
t = type v = value s = ??.
- #value ⇒ Object
Constructor Details
#initialize(**attrs) ⇒ Cell
t = type v = value s = ??
168 169 170 |
# File 'lib/ooxml_excel/sheet.rb', line 168 def initialize(**attrs) attrs.each { |property, value| send("#{property}=", value)} end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
164 165 166 |
# File 'lib/ooxml_excel/sheet.rb', line 164 def id @id end |
#s ⇒ Object
Returns the value of attribute s.
164 165 166 |
# File 'lib/ooxml_excel/sheet.rb', line 164 def s @s end |
#shared_strings ⇒ Object
Returns the value of attribute shared_strings.
164 165 166 |
# File 'lib/ooxml_excel/sheet.rb', line 164 def shared_strings @shared_strings end |
#t ⇒ Object
Returns the value of attribute t.
164 165 166 |
# File 'lib/ooxml_excel/sheet.rb', line 164 def t @t end |
#v ⇒ Object
Returns the value of attribute v.
164 165 166 |
# File 'lib/ooxml_excel/sheet.rb', line 164 def v @v end |
Class Method Details
.load_from_node(cell_node, shared_strings) ⇒ Object
176 177 178 179 180 181 182 |
# File 'lib/ooxml_excel/sheet.rb', line 176 def self.load_from_node(cell_node, shared_strings) new(id: cell_node.attributes["r"].try(:value), t: cell_node.attributes["t"].try(:value), s: cell_node.attributes["s"].try(:value), v: cell_node.at('v').try(:text), shared_strings: shared_strings ) end |
Instance Method Details
#value ⇒ Object
172 173 174 |
# File 'lib/ooxml_excel/sheet.rb', line 172 def value (v.present?) ? shared_strings[v.to_i] : nil end |