vendor/plugins/cross_site_sniper/lib/cross_site_sniper.rb
# This is an *optional* method to fine tune which string and text fields
# to automatically escape. Without calling html_escape, all automatically
# generated accessor methods tied to string and text fields in the database
# will be automatically escaped.
#
# === Configuration Options:
#
# * +only+ - specifies a list of column names to escape.
# * +except+ - specifies a list of column names to not escape.
# * +none+ - disables automatic escaping for entire class.
# * +all+ - (default) auto-escapes all fields. Same as not calling
#   html_escape at all.
#
# === Examples
#
#   Class Snipe < ActiveRecord::Base
#     html_escape :only => [:species, :genus]
#   # *OR*
#     html_escape :except => :description
#   # *OR*
#     html_escape :none
#   # *OR*
#     html_escape :all   #Same as not calling html_escape at all.
#   end
#
This is an *optional* method to fine tune which string and text fields
to automatically escape. Without calling html_escape, all automatically
generated accessor methods tied to string and text fields in the database
will be automatically escaped.

Configuration Options.

+only+ - specifies a list of column names to escape.
+except+ - specifies a list of column names to not escape.
+none+ - disables automatic escaping for entire class.
+all+ - (default) auto-escapes all fields. Same as not calling
html_escape at all.

Examples


This is an * optional * method to fine tune which string and text fields to automatically escape . Without calling html_escape all automatically generated accessor methods tied to string and text fields in the database will be automatically escaped . Configuration Options . + only + - specifies a list of column names to escape . + except + - specifies a list of column names to not escape . + none + - disables automatic escaping for entire class . + all + - ( default ) auto - escapes all fields . Same as not calling html_escape at all . Examples
def html_escape(opts = {})
        opts = {opts => true} unless opts.is_a?(Hash)
        opts.assert_valid_keys(:only,:except,:none,:all)
        class_eval do
          if opts[:except]
            @cross_site_sniper_excepted_fields = [opts[:except]].flatten
          elsif opts[:only]
            @cross_site_sniper_only_fields = [opts[:only]].flatten
          elsif opts[:none]
            @cross_site_sniper_only_fields = Array.new
          end
        end
      end
def html_escape ( opts = { } ) opts = { opts => true } unless opts . is_a? ( Hash ) opts . assert_valid_keys ( :only , :except , :none , :all ) class_eval do if opts [ :except ] @cross_site_sniper_excepted_fields = [ opts [ :except ] ] . flatten elsif opts [ :only ] @cross_site_sniper_only_fields = [ opts [ :only ] ] . flatten elsif opts [ :none ] @cross_site_sniper_only_fields = Array . new end end end
This is an *optional* method to fine tune which string and text fields
to automatically escape.
This is an * optional * method to fine tune which string and text fields to automatically escape .
opts
<not_specific>