Sha256: 9ed96a7852dba405f1a28026fba5b99a742983acb62f8fadc6d24ce6fe3c08aa

Contents?: true

Size: 1.05 KB

Versions: 22

Compression:

Stored size: 1.05 KB

Contents

class Card
  class Bootstrap
    # shared methods for OldComponent and TagMethod
    module Content
      private

      def process_collected_content tag_name, opts
        collected_content = @content.pop
        tag_name = opts.delete(:tag) if tag_name == :yield
        add_content content_tag(tag_name, collected_content, opts, false)
      end

      def process_content &content_block
        content, opts = yield
        wrappers = @wrap.pop
        if wrappers.present?
          process_wrappers wrappers, content, &content_block
        else
          add_content content
        end
        opts
      end

      def process_append
        @append.pop.each do |block|
          add_content instance_exec(&block)
        end
      end

      def process_wrappers wrappers, content, &content_block
        while wrappers.present?
          wrapper = wrappers.shift
          if wrapper.is_a? Symbol
            send wrapper, &content_block
          else
            instance_exec content, &wrappers.shift
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
card-mod-bootstrap-0.18.1 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.18.0 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.17.0 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.16.0 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.15.6 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.15.5 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.15.4 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.15.3 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.15.1.2 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.15.2.pre1 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.15.1.1 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.15.1 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.15.0 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.14.2 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.14.1 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.14.0 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.13.4 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.13.3 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.13.2 lib/card/bootstrap/content.rb
card-mod-bootstrap-0.13.1 lib/card/bootstrap/content.rb