Class: YAS::SymbolizeExt

Inherits:
Object
  • Object
show all
Defined in:
lib/yas/ext/symbolize.rb

Overview

Symbolize keys

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.apply(schema, hash) ⇒ Object



24
25
26
27
28
# File 'lib/yas/ext/symbolize.rb', line 24

def self.apply schema, hash
  hash.keys.each do |key|
    hash[(key.to_sym rescue key) || key] = hash.delete(key)
  end if schema.symbolize
end

.when_schema_inherited(superschema, subschema) ⇒ Object



19
20
21
# File 'lib/yas/ext/symbolize.rb', line 19

def self.when_schema_inherited superschema, subschema
  subschema.symbolize(superschema.symbolize)
end

.when_used(schema) ⇒ Object



14
15
16
# File 'lib/yas/ext/symbolize.rb', line 14

def self.when_used schema
  schema.extend ClassMethods
end