Sha256: 2129bd7e78048cd90545b799622f7dbaf69334a5d505ef47425ae3cb9e1542ec

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

require_relative 'lists/line'
require_relative 'lists/separator'
require_relative 'mixins/content'
require_relative 'mixins/append'

module Voom
  module Presenters
    module DSL
      module Components
        class List < Base
          include Mixins::Content
          include Mixins::Append
          
          attr_reader :lines, :lines_only
          attr_accessor :components
          
          def initialize(**attribs_, &block)
            super(type: :list, context: context,
                  **attribs_, &block)
            @lines_only = attribs.delete(:lines_only)||false
            @lines = []
            @components = []
            expand!
          end
          
          def line(text=nil, **attribs, &block)
            @lines << Lists::Line.new(parent:self, context: context, text: text, **attribs, &block)
          end

          def separator(**attribs, &block)
            @lines << Lists::Separator.new(parent:self, context: context, **attribs, &block)
          end
        end
      end
    end
  end
end


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
voom-presenters-0.1.7 lib/voom/presenters/dsl/components/list.rb
voom-presenters-0.1.6 lib/voom/presenters/dsl/components/list.rb
voom-presenters-0.1.5 lib/voom/presenters/dsl/components/list.rb
voom-presenters-0.1.4 lib/voom/presenters/dsl/components/list.rb
voom-presenters-0.1.3 lib/voom/presenters/dsl/components/list.rb
voom-presenters-0.1.2 lib/voom/presenters/dsl/components/list.rb
voom-presenters-0.1.1 lib/voom/presenters/dsl/components/list.rb
voom-presenters-0.1.0 lib/voom/presenters/dsl/components/list.rb