Sha256: c698d7076463a78da9ce432a5f7f24689568c1e3b508c66cdda663c571a40a90

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

module Quarry

  module Spec

    # = Step
    #
    class Step
      attr :parent
      attr :code
      attr :lineno

      def initialize(parent, code, lineno)
        @parent = parent
        @code   = code.rstrip
        @lineno = lineno
      end

      alias_method :spec, :parent

      #def description
      #  alias_method :description, :text
      #end
    end

    # = Macro
    #
    class Macro < Step
      attr :type
      def initialize(parent, code, lineno, type)
        super(parent, code, lineno)
        @type = type
      end
    end

    # = Header
    #
    class Header
      attr :parent
      attr :text
      attr :lineno

      def initialize(parent, text, lineno)
        @parent = parent
        @text   = text.strip
        @lineno = lineno
      end

      alias_method :spec, :parent
      alias_method :description, :text
    end

    # = Comment
    #
    class Comment
      attr :parent
      attr :text
      attr :lineno

      def initialize(parent, text, lineno)
        @parent = parent
        @text   = text.strip
        @lineno = lineno
      end

      alias_method :spec, :parent
      alias_method :description, :text

      #
      def type
        /^(\w{1,9})[:]/i =~ text
        $1.downcase.to_sym if $1
      end
      alias_method :macro?, :type
    end

  end#module Spec

end#module Quarry

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quarry-0.4.0 lib/quarry/spec/step.rb