Sha256: 3d6cb3bf0cfc0d62056310ba612d6c4fde59fa42c66012c50a449d0acc10bfe8

Contents?: true

Size: 911 Bytes

Versions: 37

Compression:

Stored size: 911 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

37 entries across 37 versions & 2 rubygems

Version Path
caracal_the_curve-1.4.6 lib/caracal/core/rules.rb
caracal_the_curve-1.4.5 lib/caracal/core/rules.rb
caracal_the_curve-1.4.4 lib/caracal/core/rules.rb
caracal_the_curve-1.4.3 lib/caracal/core/rules.rb
caracal_the_curve-1.4.2 lib/caracal/core/rules.rb
caracal_the_curve-1.4.1 lib/caracal/core/rules.rb
caracal-1.4.1 lib/caracal/core/rules.rb
caracal-1.4.0 lib/caracal/core/rules.rb
caracal-1.3.0 lib/caracal/core/rules.rb
caracal-1.2.0 lib/caracal/core/rules.rb
caracal-1.1.2 lib/caracal/core/rules.rb
caracal-1.1.1 lib/caracal/core/rules.rb
caracal-1.1.0 lib/caracal/core/rules.rb
caracal-1.0.13 lib/caracal/core/rules.rb
caracal-1.0.12 lib/caracal/core/rules.rb
caracal-1.0.11 lib/caracal/core/rules.rb
caracal-1.0.10 lib/caracal/core/rules.rb
caracal-1.0.9 lib/caracal/core/rules.rb
caracal-1.0.8 lib/caracal/core/rules.rb
caracal-1.0.7 lib/caracal/core/rules.rb