Module: Paradocs::Whitelist

Defined in:
lib/paradocs/whitelist.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

FILTERED =

Example

class Foo
  include Paradocs::DSL
  include Paradocs::Whitelist

  schema(:test) do
    field(:title).type(:string).whitelisted
    field(:age).type(:integer).default(20)
  end
end

foo    = Foo.new
schema = foo.class.schema(:test)
params = {title: "title", age: 25}
foo.filter!(params, schema) # => {title: "title", age: "[FILTERED]"}
"[FILTERED]"
EMPTY =
"[EMPTY]"

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



22
23
24
# File 'lib/paradocs/whitelist.rb', line 22

def self.included(base)
  base.include(ClassMethods)
end