Sha256: 442e8c73308a61c47d9c3b372b01bf3880b57fefba9f1d4285b8f27755936fb2

Contents?: true

Size: 820 Bytes

Versions: 9

Compression:

Stored size: 820 Bytes

Contents

module Ixtlan
  module Core
    module XFrameHeaders

      protected

      def x_frame_headers(mode = nil)
        case mode || self.class.instance_variable_get(:@_x_frame_headers) || Rails.configuration.x_frame_headers || :deny
        when :deny
          response.headers["X-Frame-Options"] = "DENY"
        when :sameorigin
          response.headers["X-Frame-Options"] = "SAMEORIGIN"
        when :off
        else
          warn "allowed values for x_frame_headers are :deny, :sameorigin, :off"
        end
      end
    
      def self.included(base)
        base.class_eval do
          def self.x_frame_headers(mode)
            if(mode)
              @_x_frame_headers = mode.to_sym
            else
              @_x_frame_headers = nil
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ixtlan-core-0.8.0 lib/ixtlan/core/x_frame_headers.rb
ixtlan-core-0.7.5 lib/ixtlan/core/x_frame_headers.rb
ixtlan-core-0.7.4 lib/ixtlan/core/x_frame_headers.rb
ixtlan-core-0.7.3 lib/ixtlan/core/x_frame_headers.rb
ixtlan-core-0.7.2 lib/ixtlan/core/x_frame_headers.rb
ixtlan-core-0.7.1 lib/ixtlan/core/x_frame_headers.rb
ixtlan-core-0.7.0 lib/ixtlan/core/x_frame_headers.rb
ixtlan-core-0.6.1 lib/ixtlan/core/x_frame_headers.rb
ixtlan-core-0.6.0 lib/ixtlan/core/x_frame_headers.rb