Просмотр исходного кода

Make NewXlsxSSTFromRefTable into RefTable.makeXlsxSST, for consistency.

Geoffrey J. Teale 11 лет назад
Родитель
Сommit
bb8941958d
2 измененных файлов с 6 добавлено и 6 удалено
  1. 4 4
      sharedstrings.go
  2. 2 2
      sharedstrings_test.go

+ 4 - 4
sharedstrings.go

@@ -60,13 +60,13 @@ func MakeSharedStringRefTable(source *xlsxSST) RefTable {
 	return reftable
 }
 
-// NewXlsxSSTFromRefTable() takes a RefTable and returns and
+// makeXlsxSST() takes a RefTable and returns and
 // equivalent xlsxSST representation.
-func NewXlsxSSTFromRefTable(refTable RefTable) xlsxSST {
+func (rt RefTable) makeXlsxSST() xlsxSST {
 	sst := xlsxSST{}
-	sst.Count = len(refTable)
+	sst.Count = len(rt)
 	sst.UniqueCount = sst.Count
-	for _, ref := range refTable {
+	for _, ref := range rt {
 		si := xlsxSI{}
 		si.T = ref
 		sst.SI = append(sst.SI, si)

+ 2 - 2
sharedstrings_test.go

@@ -77,11 +77,11 @@ func (s *SharedStringsSuite) TestUnmarshallSharedStrings(c *C) {
 }
 
 // Test we can correctly create the xlsx.xlsxSST struct from a RefTable
-func (s *SharedStringsSuite) TestNewXLSXSSTFromRefTable(c *C) {
+func (s *SharedStringsSuite) TestMakeXlsxSST(c *C) {
 	refTable := NewSharedStringRefTable()
 	refTable = append(refTable, "Foo")
 	refTable = append(refTable, "Bar")
-	sst := NewXlsxSSTFromRefTable(refTable)
+	sst := refTable.makeXlsxSST()
 	c.Assert(sst, NotNil)
 	c.Assert(sst.Count, Equals, 2)
 	c.Assert(sst.UniqueCount, Equals, 2)