Sha256: f9e53c76bb36b461ef30e4d7754f3c57792ad4826266194ad67904db5ad2b07b

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'set'
require File.dirname(__FILE__) + "/dsl"
require File.dirname(__FILE__) + "/feature_filters"
require File.dirname(__FILE__) + "/sso_filters"
module CQL
  QUERY_VALUES = %w(name uri line description type steps id tags examples)

  class MapReduce
    CQL::QUERY_VALUES.each do |property|
      define_singleton_method(property) do |input|
        input = [input] if input.class != Array
        input.map { |a| a[property] }
      end
    end

    %w(all everything complete).each do |method_name|
      define_singleton_method(method_name) { |input| input }
    end

    def self.step_lines input
      input = [input] if input.class != Array
      steps(input).map do |scen|
        scen.map { |line| line['keyword'] + line['name'] }
      end
    end

    def self.feature_children input, args
      results = []
      input = filter_features(input, 'feature'=>args['feature']) if args.has_key?('feature')
      input.each do |feature|
        feature['elements'].each do |element|
          results.push element if element['type'] == args['what']
        end
      end
      results
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cql-0.1.9 lib/map_reduce.rb