Sha256: d389defdbe6f2331afcff5a31a6fd1c408f1a0f72f7ba101c5079008d255bdd3

Contents?: true

Size: 1.12 KB

Versions: 17

Compression:

Stored size: 1.12 KB

Contents

require 'caracal/core/models/iframe_model'
require 'caracal/errors'


module Caracal
  module Core

    # This module encapsulates all the functionality related to inserting
    # word document snippets into the document.
    #
    module IFrames
      def self.included(base)
        base.class_eval do

          #-------------------------------------------------------------
          # Public Methods
          #-------------------------------------------------------------

          def iframe(options={}, &block)
            model = Caracal::Core::Models::IFrameModel.new(options, &block)
            if model.valid?
              model.preprocess!
              model.namespaces.each do |(prefix, href)|
                namespace({ prefix: prefix, href: href })
              end
              model.ignorables.each do |prefix|
                ignorable(prefix)
              end

              contents << model
            else
              raise Caracal::Errors::InvalidModelError, 'IFrameModel requires either the :url or :data argument.'
            end
            model
          end

        end
      end
    end

  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

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