Class: ApexCharts::Options::DrySchema::Schema

Inherits:
Dry::Schema::Params
  • Object
show all
Defined in:
lib/apex_charts/options/dry_schema/schema.rb

Class Method Summary collapse

Class Method Details

.check(hash) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/apex_charts/options/dry_schema/schema.rb', line 9

def check(hash)
  return hash if production?

  schema = new[hash]
  if schema.failure?
    raise schema.errors.to_h.inspect
  else
    hash
  end
end

.keysObject



20
21
22
# File 'lib/apex_charts/options/dry_schema/schema.rb', line 20

def keys
  definition.send(:key_map).map{|key| key.name.to_sym }
end