Class: Transformers::ClassInstantier
- Inherits:
-
Object
- Object
- Transformers::ClassInstantier
- Defined in:
- lib/transformers/activations.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(data) ⇒ ClassInstantier
constructor
A new instance of ClassInstantier.
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 |