Sha256: 3fda19477ec3a23800a422173cc8d40435b3dd2fc3341922d48720dc00d8dcec

Contents?: true

Size: 440 Bytes

Versions: 5

Compression:

Stored size: 440 Bytes

Contents

module Slacken
  module Helpers
    # Public: Provide DSL methods to build a DocumentComponent like S-exp.
    module DocumentComponentDsl
      def c(type_name, *children)
        options = children.first.is_a?(Hash) ? children.shift : {}
        Slacken::DocumentComponent.new(type_name, children, options)
      end

      def text(content)
        Slacken::DocumentComponent.new(:text, [], content: content)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slacken-0.1.6 spec/helpers/document_component_dsl.rb
slacken-0.1.5 spec/helpers/document_component_dsl.rb
slacken-0.1.4 spec/helpers/document_component_dsl.rb
slacken-0.1.3 spec/helpers/document_component_dsl.rb
slacken-0.1.2 spec/helpers/document_component_dsl.rb