Sha256: 9b64646536266149963e19f8a6888b3a8e42e5d00c515cfd25fe11b70c092ce6

Contents?: true

Size: 913 Bytes

Versions: 1

Compression:

Stored size: 913 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.1 lib/caracal/core/rules.rb