Sha256: 5574780f7182dcad6de186642aa7da6fef44946865721a25babc1a4699d56f5f

Contents?: true

Size: 416 Bytes

Versions: 4

Compression:

Stored size: 416 Bytes

Contents

module Weskit::WML::Mixins
  module Grammar
    module_function

    def raise_on_mismatch opening, closing
      unless opening.name == closing.name
        raise ::Weskit::WML::Errors::ParseError, 'Invalid element'
      end
    end

    def reject_non_wml elements
      elements.reduce(Array.new) do |array, element|
        array << element.item if element.respond_to? :item ; array
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
weskit-0.3.6 lib/weskit/wml/mixins/grammar.rb
weskit-0.3.5 lib/weskit/wml/mixins/grammar.rb
weskit-0.3.4 lib/weskit/wml/mixins/grammar.rb
weskit-0.3.3 lib/weskit/wml/mixins/grammar.rb