Class: Transformers::ClassInstantier

Inherits:
Object
  • Object
show all
Defined in:
lib/transformers/activations.rb

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ClassInstantier

Returns a new instance of ClassInstantier.



36
37
38
# File 'lib/transformers/activations.rb', line 36

def initialize(data)
  @data = data
end

Instance Method Details

#[](key) ⇒ Object



40
41
42
43
44
# File 'lib/transformers/activations.rb', line 40

def [](key)
  content = @data.fetch(key)
  cls, kwargs = content.is_a?(Array) ? content : [content, {}]
  cls.new(**kwargs)
end