Sha256: 083eb0dc45395696dad3e35ebe4452b2fdb9950a3a2cfa589759db8e30ca3b7a
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require 'caracal/core/models/list_model' require 'caracal/errors' module Caracal module Core # This module encapsulates all the functionality related to adding # horizontal rules to the document. # module Lists def self.included(base) base.class_eval do #------------------------------------------------------------- # Public Methods #------------------------------------------------------------- #============== ATTRIBUTES ========================== def ol(options = {}, &block) options.merge!({ type: :ordered, level: 0 }) model = Caracal::Core::Models::ListModel.new(options, &block) if model.valid? contents << model else raise Caracal::Errors::InvalidModelError, 'Ordered lists require at least one list item.' end model end def ul(options = {}, &block) options.merge!({ type: :unordered, level: 0 }) model = Caracal::Core::Models::ListModel.new(options, &block) if model.valid? contents << model else raise Caracal::Errors::InvalidModelError, 'Unordered lists require at least one list item.' end model end #============== GETTERS ========================== def toplevel_lists @toplevel_lists ||= [] end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caracal-0.1.1 | lib/caracal/core/lists.rb |