Class: ActiveRecord::Base

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

Overview

Refer to ArDumper for ActiveRecord extensions

Class Method Summary collapse

Class Method Details

.dump_to_yaml(options = {}) ⇒ Object

Dump to yml Same as ActiveRecord::Base.dumper :yml



12
13
14
# File 'lib/ar_dumper_active_record.rb', line 12

def self.dump_to_yaml(options={})
  dumper :yml, options
end

.dumper(format, options = {}) ⇒ Object

Dump data

  • format - type of dump (:csv, :yml, :xml)

  • options - Dumper options. Refer to ArDumper



19
20
21
# File 'lib/ar_dumper_active_record.rb', line 19

def self.dumper(format, options={})
  ArDumper.new(self, options).dump(format)
end

.dumper_to_string(format, options = {}) ⇒ Object

Dump to string. Same as ActiveRecord::Base.dumper format, :target_type => :string



25
26
27
# File 'lib/ar_dumper_active_record.rb', line 25

def self.dumper_to_string(format, options={})
  dumper(format, options.update({:target_type => :string}))
end

.to_csv(options = {}) ⇒ Object

Dump to csv string Same as ActiveRecord::Base.dumper :csv, :target_type => :string



6
7
8
# File 'lib/ar_dumper_active_record.rb', line 6

def self.to_csv(options={})
  dump_to_string :csv, options
end