Class: ConvenientService::Examples::Standard::RequestParams::Utils::Array::Wrap

Inherits:
Command
  • Object
show all
Defined in:
lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ void

Parameters:

  • object (Object)

    Can be any type.



20
21
22
# File 'lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb', line 20

def initialize(object)
  @object = object
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



14
15
16
# File 'lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb', line 14

def object
  @object
end

#padObject (readonly)

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



14
# File 'lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb', line 14

attr_reader :object

Instance Method Details

#callArray

Returns:



31
32
33
34
35
36
37
38
39
# File 'lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb', line 31

def call
  if object.nil?
    []
  elsif object.respond_to?(:to_ary)
    object.to_ary || [object]
  else
    [object]
  end
end