Sha256: 051b65b9ac3a6a24f4acdf3f216158ef211eb41f02f31374a57f65deca4c68d9

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 Bytes

Contents

module Smile
  class Json 
  
    class << self
      def parse( text )
        Smile::Base.logger.info( text )
        @result = Yajl::Parser.parse(text) # This is the default JSON parse
        raise_exception! if has_error?
        @result  
      end

      def has_error?
        @result["stat"] == 'fail'
      end

      def error_message
        @result["message"] if has_error?
      end

      def raise_exception!
        raise Smile::Exception.new( error_message )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smile-0.4.4 lib/smile/json.rb