Class: OOXML::Excel::Sheet::Row::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_excel/sheet.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#idObject

Returns the value of attribute id.



164
165
166
# File 'lib/ooxml_excel/sheet.rb', line 164

def id
  @id
end

#sObject

Returns the value of attribute s.



164
165
166
# File 'lib/ooxml_excel/sheet.rb', line 164

def s
  @s
end

#shared_stringsObject

Returns the value of attribute shared_strings.



164
165
166
# File 'lib/ooxml_excel/sheet.rb', line 164

def shared_strings
  @shared_strings
end

#tObject

Returns the value of attribute t.



164
165
166
# File 'lib/ooxml_excel/sheet.rb', line 164

def t
  @t
end

#vObject

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

#valueObject



172
173
174
# File 'lib/ooxml_excel/sheet.rb', line 172

def value
  (v.present?) ? shared_strings[v.to_i] : nil
end