Module: Sp2db::ImportConcern::ClassMethods
- Defined in:
- lib/sp2db/import_concern.rb
Instance Method Summary collapse
- #sp2db_config ⇒ Object
- #sp2db_header_row(s = nil) ⇒ Object
- #sp2db_import_strategy(s = nil) ⇒ Object
- #sp2db_options(*args, &block) ⇒ Object
- #sp2db_priority(pr = nil) ⇒ Object
- #sp2db_sheet_name(s = nil) ⇒ Object
- #sp2db_spreadsheet_id(s = nil) ⇒ Object
Instance Method Details
#sp2db_config ⇒ Object
22 23 24 |
# File 'lib/sp2db/import_concern.rb', line 22 def sp2db_config @sp2db_config ||= {}.with_indifferent_access end |
#sp2db_header_row(s = nil) ⇒ Object
54 55 56 57 |
# File 'lib/sp2db/import_concern.rb', line 54 def sp2db_header_row s=nil sp2db_config[:header_row] = s if s.present? sp2db_config[:header_row] end |
#sp2db_import_strategy(s = nil) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/sp2db/import_concern.rb', line 39 def sp2db_import_strategy s=nil if s.present? s = s.to_sym ImportStrategy.valid! s sp2db_config[:import_strategy] = s end sp2db_config[:import_strategy] end |
#sp2db_options(*args, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sp2db/import_concern.rb', line 11 def *args, &block if args.first.is_a?(Hash) args.first.each do |k, v| send "sp2db_#{k}", v end else meth = args.shift send "sp2db_#{meth}", *args, &block end end |
#sp2db_priority(pr = nil) ⇒ Object
34 35 36 37 |
# File 'lib/sp2db/import_concern.rb', line 34 def sp2db_priority pr=nil sp2db_config[:priority] = pr if pr.present? sp2db_config[:priority] end |
#sp2db_sheet_name(s = nil) ⇒ Object
49 50 51 52 |
# File 'lib/sp2db/import_concern.rb', line 49 def sp2db_sheet_name s=nil sp2db_config[:sheet_name] = s.to_sym if s.present? sp2db_config[:sheet_name] end |
#sp2db_spreadsheet_id(s = nil) ⇒ Object
59 60 61 62 |
# File 'lib/sp2db/import_concern.rb', line 59 def sp2db_spreadsheet_id s=nil sp2db_config[:spreadsheet_id] = s if s.present? sp2db_config[:spreadsheet_id] end |