Sha256: 28bd0c2aa6fb6ddf41257a2a11c021199d0de453fb2ab6e101949b998402adba

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

require_relative 'exceptions'
require_relative 'success_message_parser'
require_relative 'error_message_parser'
require_relative 'fail_message_parser'

module JSend

  class Parser

    def self.parser_for(type)
      case type
      when JSend::SUCCESS
        SuccessMessageParser
      when JSend::ERROR
        ErrorMessageParser
      when JSend::FAIL
        FailMessageParser
      else
        raise JSend::InvalidType
      end
    end

  end

  private_constant :Parser
  private_constant :SuccessMessageParser
  private_constant :ErrorMessageParser
  private_constant :FailMessageParser

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jsend-0.1.0 lib/jsend/parser/parser.rb