Sha256: 886bec01e80a13b1ad0be9115da65ba990d6f8fae44d042e01562b740285ed8a

Contents?: true

Size: 817 Bytes

Versions: 8

Compression:

Stored size: 817 Bytes

Contents

#
#       ActiveFacts Generators.
#       Generate text output (verbalise the meta-vocabulary) for ActiveFacts vocabularies.
#
# Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
#
require 'activefacts/registry'

module ActiveFacts
  module Generators
    # Generate a text verbalisation of the metamodel constellation created for an ActiveFacts vocabulary.
    # Invoke as
    #   afgen --text <file>.cql
    class TEXT
    private
      def initialize(vocabulary)
        @vocabulary = vocabulary
        @vocabulary = @vocabulary.Vocabulary.values[0] if ActiveFacts::API::Constellation === @vocabulary
      end

    public
      def generate(out = $>)
        out.puts @vocabulary.constellation.verbalise
      end
    end
  end
end

ActiveFacts::Registry.generator('text', ActiveFacts::Generators::TEXT)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activefacts-generators-1.9.2 lib/activefacts/generators/text.rb
activefacts-generators-1.9.1 lib/activefacts/generators/text.rb
activefacts-generators-1.9.0 lib/activefacts/generators/text.rb
activefacts-generators-1.8.3 lib/activefacts/generators/text.rb
activefacts-generators-1.8.2 lib/activefacts/generators/text.rb
activefacts-generators-1.8.1 lib/activefacts/generators/text.rb
activefacts-generators-1.8.0 lib/activefacts/generators/text.rb
activefacts-generators-1.7.1 lib/activefacts/generators/text.rb