Class: OBender

Inherits:
Object
  • Object
show all
Defined in:
lib/obender.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ OBender

Returns a new instance of OBender.



2
3
4
# File 'lib/obender.rb', line 2

def initialize(*args)
  @args = args
end

Instance Method Details

#vasyukiObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/obender.rb', line 6

def vasyuki
  return @args[0].map { |arg| [arg] } if @args.size == 1
  return [] if @args.size == 0

  @args.reduce do |acc, item|
    result = []
    acc.each do |a|
      item.each do |i|
        a.kind_of?(Array) ? result << (a + [i]) : result << ([a] + [i])
      end
    end
    result
  end
end