Class: ConvenientService::Utils::Array::Wrap
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Array::Wrap
- Defined in:
- lib/convenient_service/utils/array/wrap.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#pad ⇒ Object
readonly
Can be any type.
Instance Method Summary collapse
- #call ⇒ Array
- #initialize(object) ⇒ void constructor
Methods inherited from Support::Command
Constructor Details
#initialize(object) ⇒ void
17 18 19 |
# File 'lib/convenient_service/utils/array/wrap.rb', line 17 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
11 12 13 |
# File 'lib/convenient_service/utils/array/wrap.rb', line 11 def object @object end |
#pad ⇒ Object (readonly)
Returns Can be any type.
11 |
# File 'lib/convenient_service/utils/array/wrap.rb', line 11 attr_reader :object |
Instance Method Details
#call ⇒ Array
28 29 30 31 32 33 34 35 36 |
# File 'lib/convenient_service/utils/array/wrap.rb', line 28 def call if object.nil? [] elsif object.respond_to?(:to_ary) object.to_ary || [object] else [object] end end |