Class: Formstack::Collection

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/formstack/collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(array, klass:, context: []) ⇒ Collection

Returns a new instance of Collection.



5
6
7
8
9
# File 'lib/formstack/collection.rb', line 5

def initialize(array, klass:, context: [])
  @klass = klass
  @context = context
  super(array)
end

Instance Method Details

#create(*args) ⇒ Object



11
12
13
# File 'lib/formstack/collection.rb', line 11

def create(*args)
  @klass.create(*@context, *args)
end