Module: FastExcel::AttributeHelper

Included in:
FormatExt, WorkbookExt, WorksheetExt
Defined in:
lib/fast_excel.rb

Instance Method Summary collapse

Instance Method Details

#fields_hashObject


317
318
319
320
321
322
323
324
# File 'lib/fast_excel.rb', line 317

def fields_hash
  res = {}
  members.each do |key|
    #p [key, self[key]]
    res[key] = respond_to?(key) ? send(key) : self[key]
  end
  res
end

#pretty_print(pp) ⇒ Object


326
327
328
# File 'lib/fast_excel.rb', line 326

def pretty_print(pp)
  pp fields_hash
end

#set(values) ⇒ Object


303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/fast_excel.rb', line 303

def set(values)
  values.each do |key, value|
    if respond_to?("#{key}=")
      send("#{key}=", value)
    elsif respond_to?("set_#{key}=")
      send("set_#{key}=", value)
    else
      self[key] = value
    end
  end

  self
end