Sha256: 8da4862a074014f8cae2c15227b8358e337ffe305a835fa8ab75f082f41a96dd

Contents?: true

Size: 625 Bytes

Versions: 3

Compression:

Stored size: 625 Bytes

Contents

module Finitio
  module Syntax
    module Heading
      include Node

      capture :allow_extra

      def allow_extra?
        !allow_extra.nil?
      end

      def multi?
        captures[:attribute].any?{|a| a.optional? } or allow_extra?
      end

      def attributes(factory)
        captures[:attribute].map{|a| a.compile(factory) }
      end

      def compile(factory)
        Finitio::Heading.new(attributes(factory), allow_extra: allow_extra?)
      end

      def to_ast
        captures[:attribute].map(&:to_ast).unshift(:heading)
      end

    end # module Heading
  end # module Syntax
end # module Finitio

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
finitio-0.5.2 lib/finitio/syntax/type/heading.rb
finitio-0.5.1 lib/finitio/syntax/type/heading.rb
finitio-0.5.0 lib/finitio/syntax/type/heading.rb