Module: ParamsReady::Parameter::ArrayParameter::ArrayLike

Includes:
ComplexParameter
Included in:
ParamsReady::Parameter::ArrayParameter, TupleParameter
Defined in:
lib/params_ready/parameter/array_parameter.rb

Instance Method Summary collapse

Methods included from ComplexParameter

#update_child

Instance Method Details

#[](index) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/params_ready/parameter/array_parameter.rb', line 22

def [](index)
  if index == :cnt || index == 'cnt'
    count = ValueParameterBuilder.instance(:cnt, :integer).build.create
    count.set_value(self.length)
    count.freeze
    count
  else
    element(index)
  end
end

#[]=(index, value) ⇒ Object



16
17
18
19
20
# File 'lib/params_ready/parameter/array_parameter.rb', line 16

def []=(index, value)
  init_for_write
  c = element(index)
  c.set_value value
end