Class: Mincer::Processors::PgJsonDumper::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/mincer/processors/pg_json_dumper/processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(mincer, options = {}) ⇒ Processor

Returns a new instance of Processor.



6
7
8
# File 'lib/mincer/processors/pg_json_dumper/processor.rb', line 6

def initialize(mincer, options = {})
  @mincer, @args, @relation, @options = mincer, mincer.args, mincer.relation, options
end

Instance Method Details

#applyObject



10
11
12
# File 'lib/mincer/processors/pg_json_dumper/processor.rb', line 10

def apply
  @relation
end

#to_jsonObject



14
15
16
17
18
19
20
# File 'lib/mincer/processors/pg_json_dumper/processor.rb', line 14

def to_json
  if dump_supported?
    Mincer.connection.execute(json_query).first['json']
  else
    warn 'To dump data to json with postgres you need to use postgres server version >= 9.2'
  end
end