Sha256: 53d1b4e9966e11239c7b27033bc308924c102bbe53d8cee20e88e61b81551aca
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 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.0 | lib/caracal/core/lists.rb |