Class: Mincer::Processors::PgJsonDumper
- Inherits:
-
Object
- Object
- Mincer::Processors::PgJsonDumper
- Defined in:
- lib/mincer/processors/pg_json_dumper.rb
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(mincer, options = {}) ⇒ PgJsonDumper
constructor
A new instance of PgJsonDumper.
- #to_json ⇒ Object
Constructor Details
#initialize(mincer, options = {}) ⇒ PgJsonDumper
Returns a new instance of PgJsonDumper.
5 6 7 |
# File 'lib/mincer/processors/pg_json_dumper.rb', line 5 def initialize(mincer, = {}) @mincer, @args, @relation, @options = mincer, mincer.args, mincer.relation, end |
Instance Method Details
#apply ⇒ Object
9 10 11 |
# File 'lib/mincer/processors/pg_json_dumper.rb', line 9 def apply @relation end |
#to_json ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/mincer/processors/pg_json_dumper.rb', line 13 def to_json if dump_supported? Mincer.connection.execute(@options[:root] ? query_with_root(@options[:root]) : query).first['json'] else warn 'To dump data to json with postgres you need to use postgres server version >= 9.2' end end |