lib/map_reduce.rb in cql-0.2.0 vs lib/map_reduce.rb in cql-0.2.1
- old
+ new
@@ -1,18 +1,16 @@
-require_relative "dsl"
-require_relative "feature_filters"
-require_relative "sso_filters"
-
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.dup
+ input = [input] if input.class != Array
input.map { |a| a[property] }
end
end
%w(all everything complete).each do |method_name|
@@ -26,9 +24,10 @@
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
\ No newline at end of file