class Rubadana::Program

Attributes

group[RW]
groups[RW]
map[RW]
reduce[RW]

Public Instance Methods

run(things) click to toggle source
# File lib/rubadana.rb, line 60
def run things
  self.groups = Hash.new { |h, k| h[k] = [] }
  things.each { |thing|
    groups[group.map { |g| g.run thing }] << thing
  }

  groups.map { |key, things|
    mapped  = map.map  { |m| things.map  { |thing| m.run thing } }
    reduced = reduce.zip(mapped).map { |r, m| r.reduce m           }
    Analysis.new(program: self, key: key, list: things, mapped: mapped, reduced: reduced )
  }
end