Sha256: b261d20744851484714d23828f32ca3c63a7726fbb34257a1e6ac682f55f79fe
Contents?: true
Size: 648 Bytes
Versions: 53
Compression:
Stored size: 648 Bytes
Contents
require "active_support/parameter_filter" class Jets::Controller class ParametersFilter attr_reader :filters, :params_filter def initialize(filters) @filters = filters @params_filter = ActiveSupport::ParameterFilter.new(filters) end def filter(params) params && params_filter.filter(params) end def filter_json(json_text) return json_text if filters.blank? || json_text.blank? begin hash_params = JSON.parse(json_text) filtered_params = filter(hash_params) JSON.dump(filtered_params) rescue JSON::ParserError String.new end end end end
Version data entries
53 entries across 53 versions & 2 rubygems