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 = ??
175 176 177 |
# File 'lib/ooxml_excel/sheet.rb', line 175 def initialize(**attrs) attrs.each { |property, value| send("#{property}=", value)} end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
171 172 173 |
# File 'lib/ooxml_excel/sheet.rb', line 171 def id @id end |
#s ⇒ Object
Returns the value of attribute s.
171 172 173 |
# File 'lib/ooxml_excel/sheet.rb', line 171 def s @s end |
#shared_strings ⇒ Object
Returns the value of attribute shared_strings.
171 172 173 |
# File 'lib/ooxml_excel/sheet.rb', line 171 def shared_strings @shared_strings end |
#t ⇒ Object
Returns the value of attribute t.
171 172 173 |
# File 'lib/ooxml_excel/sheet.rb', line 171 def t @t end |
#v ⇒ Object
Returns the value of attribute v.
171 172 173 |
# File 'lib/ooxml_excel/sheet.rb', line 171 def v @v end |
Class Method Details
.load_from_node(cell_node, shared_strings) ⇒ Object
183 184 185 186 187 188 189 |
# File 'lib/ooxml_excel/sheet.rb', line 183 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
179 180 181 |
# File 'lib/ooxml_excel/sheet.rb', line 179 def value (v.present?) ? shared_strings[v.to_i] : nil end |