Sha256: b829af765be2c0b526ba7c826bd5289977c1d2a36c3ea8e60526972b9dc49a9a

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

require 'active_support/dependencies/autoload'

module Bemer
  module Builders
    class Tree
      extend ActiveSupport::Autoload

      eager_autoload do
        autoload :Element
      end

      def initialize(tree)
        @tree = tree
      end

      def block(name = '', **options, &content)
        tree.add_node(name, options, &content)
      end

      def elem(block = '', name = '', **options, &content)
        tree.add_node(block, name, options, &content)
      end

      def text(content = nil, &callback)
        tree.add_text_node(content, &callback)
      end

      protected

      attr_reader :tree
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bemer-0.1.0 lib/bemer/builders/tree.rb