module Sequitur

Namespace for the classes of sequitur gem.

File: constants.rb Purpose: definition of Sequitur constants.

File: digram.rb

Constants

Description

@return [String] Brief description of the gem.

RootDir

@return [String] The start folder of Sequitur.

Version

@return [String] The version number of the gem.

Public Class Methods

build_from(tokens) click to toggle source

Build a Sequitur-generated grammar based on the sequence of input tokens.

@param tokens [String, Enumerator] The input sequence of input tokens.

Can be a sequence of characters (i.e. a String) or an Enumerator.
Tokens returned by enumerator should respond to the :hash message.

@return [SequiturGrammar] a grammar that encodes the input.

# File lib/sequitur.rb, line 20
def self.build_from(tokens)
  input_sequence = case tokens
                   when String then tokens.chars
                   when Enumerator then tokens
                   else tokens.to_enum
                   end

  SequiturGrammar.new(input_sequence)
end