Sha256: f5e450fa4741ebc2442b807ca3bf59e417861cc4975ec000f2d4590c7cd2756f

Contents?: true

Size: 910 Bytes

Versions: 1

Compression:

Stored size: 910 Bytes

Contents

require 'caracal/core/models/rule_model'
require 'caracal/errors'


module Caracal
  module Core
    
    # This module encapsulates all the functionality related to adding
    # horizontal rules to the document.
    #
    module Rules
      def self.included(base)
        base.class_eval do
          
          #-------------------------------------------------------------
          # Public Methods
          #-------------------------------------------------------------
          
          def hr(**options, &block)
            model = Caracal::Core::Models::RuleModel.new(options, &block)
            
            if model.valid?
              contents << model
            else
              raise Caracal::Errors::InvalidModelError, 'Horizontal rules require non-zero :size and :spacing values.'
            end
            model
          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/rules.rb