Module: Paradocs

Defined in:
lib/paradocs.rb,
lib/paradocs/dsl.rb,
lib/paradocs/field.rb,
lib/paradocs/schema.rb,
lib/paradocs/struct.rb,
lib/paradocs/context.rb,
lib/paradocs/results.rb,
lib/paradocs/version.rb,
lib/paradocs/policies.rb,
lib/paradocs/registry.rb,
lib/paradocs/field_dsl.rb,
lib/paradocs/whitelist.rb,
lib/paradocs/base_policy.rb,
lib/paradocs/default_types.rb,
lib/paradocs/extensions/structure.rb,
lib/paradocs/extensions/payload_builder.rb

Defined Under Namespace

Modules: DSL, Extensions, FieldDSL, Policies, Struct, Whitelist Classes: BasePolicy, ConfigurationError, Context, Field, InvalidStructError, Registry, Results, Schema, Top

Constant Summary collapse

VERSION =
"1.1.6"
EMAIL_REGEXP =

Default validators

/\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i.freeze

Class Method Summary collapse

Class Method Details

.configObject



20
21
22
23
24
25
26
27
28
# File 'lib/paradocs.rb', line 20

def self.config
  @config ||= OpenStruct.new(
    explicit_errors:     false,
    whitelisted_keys:    [],
    default_schema_name: :schema,
    meta_prefix:         "_",
    whitelist_coercion:  nil
  )
end

.configure {|self.config| ... } ⇒ Object

Yields:



30
31
32
33
# File 'lib/paradocs.rb', line 30

def self.configure
  yield self.config if block_given?
  self.config
end

.policy(name, plcy = nil, &block) ⇒ Object



16
17
18
# File 'lib/paradocs.rb', line 16

def self.policy(name, plcy = nil, &block)
  registry.policy name, plcy, &block
end

.registryObject



12
13
14
# File 'lib/paradocs.rb', line 12

def self.registry
  @registry ||= Registry.new
end