Module: Supermarket::Formats

Defined in:
lib/supermarket/formats.rb

Instance Method Summary collapse

Instance Method Details

#to_htmlObject



17
18
19
# File 'lib/supermarket/formats.rb', line 17

def to_html
  Java::ComGoogleProtobuf::HtmlFormat.printToString(self)
end

#to_json(*a) ⇒ Object



9
10
11
# File 'lib/supermarket/formats.rb', line 9

def to_json(*a)
  Java::ComGoogleProtobuf::JsonFormat.printToString(self)
end

#to_rubyObject



21
22
23
24
# File 'lib/supermarket/formats.rb', line 21

def to_ruby
  require 'json'
  JSON.parse(to_json)
end

#to_xmlObject



13
14
15
# File 'lib/supermarket/formats.rb', line 13

def to_xml
  Java::ComGoogleProtobuf::XmlFormat.printToString(self)
end