Module: Stunted::Stutils

Defined in:
lib/stunted/stutils.rb

Instance Method Summary collapse

Instance Method Details

#F(hash = {}, *shapes) ⇒ Object



3
4
5
# File 'lib/stunted/stutils.rb', line 3

def F(hash = {}, *shapes)
  FunctionalHash.new(hash).become(*shapes)
end

#Fall(tuples, *args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/stunted/stutils.rb', line 11

def Fall(tuples, *args)
  first = args.first
  if first.is_a?(Hash)
    array_shapes = first[:array] || []
    hash_shapes = first[:hash] || []
  else
    hash_shapes = args
    array_shapes = []
  end
  HashArray.new(tuples.map { | row | F(row, *hash_shapes) }).
            become(*array_shapes)
end

#Fonly(tuples, *shapes) ⇒ Object



7
8
9
# File 'lib/stunted/stutils.rb', line 7

def Fonly(tuples, *shapes)
  F(tuples.first, *shapes)
end