module CMF

The top-level module for the cmf gem.

Constants

VERSION

This gem's version.

Public Class Methods

build(obj, dictionary = nil) click to toggle source

Builds a CMF message from an object.

@param obj [Hash,#each] The object to be built into a CMF message. Can be

a hash, or any object that responds to `.each` and yields (tag, value)
pairs.

@param dictionary [Hash,Array] Optional. The dictionary mapping tag

names to numbers. See {Dictionary.validate}.

@return [String] An octet string, each character representing one byte of

the CMF message.
# File lib/cmf.rb, line 20
def self.build(obj, dictionary = nil)
  Builder.new(dictionary).build(obj).to_octet
end
build_hex(obj, dictionary = nil) click to toggle source

Builds hex-encoded a CMF message from an object.

@see #CMF.build @return [String] A hex string, every 2 characters representing one byte of

the CMF message.
# File lib/cmf.rb, line 29
def self.build_hex(obj, dictionary = nil)
  Builder.new(dictionary).build(obj).to_hex
end
parse(message, dictionary = nil) click to toggle source

Parses a CMF message into an object.

@param message [String] A CMF message. @return [Hash] See {Parser.parse}.

# File lib/cmf.rb, line 37
def self.parse(message, dictionary = nil)
  Parser.new(dictionary).parse(message)
end
parse_hex(message_hex, dictionary = nil) click to toggle source

Parses a hex-encoded CMF message into an object.

@param message_hex [String] A hex-encoded CMF message. @return [Hash] See {Parser.parse}.

# File lib/cmf.rb, line 45
def self.parse_hex(message_hex, dictionary = nil)
  Parser.new(dictionary).parse_hex(message_hex)
end