Class: Refi::SsDbSheet
- Inherits:
-
Object
- Object
- Refi::SsDbSheet
- Defined in:
- lib/spreadsheet_db_refi.rb
Instance Method Summary collapse
-
#get_cell(r, c, t = false) ⇒ Object
row col transpose.
- #get_col(i, transpose = false) ⇒ Object
- #get_dims ⇒ Object
- #get_first_col(t = false) ⇒ Object
-
#get_first_row(t = false) ⇒ Object
if t is true rows and columns are transposed.
- #get_last_col(t = false) ⇒ Object
- #get_last_row(t = false) ⇒ Object
- #get_row(i, t = false) ⇒ Object
-
#initialize(ss_db, sheet_id) ⇒ SsDbSheet
constructor
A new instance of SsDbSheet.
- #prep_ex(sym, p_ary = []) ⇒ Object
Constructor Details
#initialize(ss_db, sheet_id) ⇒ SsDbSheet
Returns a new instance of SsDbSheet.
272 273 274 275 |
# File 'lib/spreadsheet_db_refi.rb', line 272 def initialize(ss_db,sheet_id) @ss_db = ss_db @sheet_id = sheet_id end |
Instance Method Details
#get_cell(r, c, t = false) ⇒ Object
row col transpose
303 304 305 306 307 |
# File 'lib/spreadsheet_db_refi.rb', line 303 def get_cell(r,c,t=false) # row col transpose r,c = c,r if t value,type_id = *prep_ex(:cell_get,[@sheet_id,r,c])[0] return SsDbCellValue.new(value,type_id) end |
#get_col(i, transpose = false) ⇒ Object
308 309 310 |
# File 'lib/spreadsheet_db_refi.rb', line 308 def get_col(i,transpose=false) return get_row(i,!transpose) end |
#get_dims ⇒ Object
279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/spreadsheet_db_refi.rb', line 279 def get_dims { col: { min: prep_ex(:get_min_col,[@sheet_id])[0][0], max: prep_ex(:get_max_col,[@sheet_id])[0][0], }, row: { min: prep_ex(:get_min_row,[@sheet_id])[0][0], max: prep_ex(:get_max_row,[@sheet_id])[0][0], }, } end |
#get_first_col(t = false) ⇒ Object
321 322 323 324 |
# File 'lib/spreadsheet_db_refi.rb', line 321 def get_first_col(t=false) return get_first_row if t return prep_ex(:get_min_col) end |
#get_first_row(t = false) ⇒ Object
if t is true rows and columns are transposed
313 314 315 316 |
# File 'lib/spreadsheet_db_refi.rb', line 313 def get_first_row(t=false) return get_first_col if t return prep_ex(:get_min_row) end |
#get_last_col(t = false) ⇒ Object
325 326 327 328 |
# File 'lib/spreadsheet_db_refi.rb', line 325 def get_last_col(t=false) return get_last_row if t return prep_ex(:get_max_col) end |
#get_last_row(t = false) ⇒ Object
317 318 319 320 |
# File 'lib/spreadsheet_db_refi.rb', line 317 def get_last_row(t=false) return get_last_col if t return prep_ex(:get_max_row) end |
#get_row(i, t = false) ⇒ Object
291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/spreadsheet_db_refi.rb', line 291 def get_row(i,t=false) q = if(t) :get_col else :get_row end row = prep_ex(q,[@sheet_id,i]).inject({}){|memo,j| memo[ j[0] ] = SsDbCellValue.new( j[1], j[2]) memo } return row end |
#prep_ex(sym, p_ary = []) ⇒ Object
276 277 278 |
# File 'lib/spreadsheet_db_refi.rb', line 276 def prep_ex(sym,p_ary=[]) @ss_db.prep_ex(sym,p_ary) end |