Module: Pump::Object

Extended by:
ActiveSupport::Concern
Defined in:
lib/pump/object.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#pump_to_json(options = {}) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/pump/object.rb', line 18

def pump_to_json(options={})
  encoder = self.class.pumps.get(options[:set], :json)
  if encoder
    encoder.encode(self, options)
  else
    to_json(options)
  end
end

#pump_to_xml(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/pump/object.rb', line 9

def pump_to_xml(options={})
  encoder = self.class.pumps.get(options[:set], :xml)
  if encoder
    encoder.encode(self, options)
  else
    to_xml(options)
  end
end