lib/regexp-examples/groups.rb in regexp-examples-0.3.2 vs lib/regexp-examples/groups.rb in regexp-examples-0.4.0
- old
+ new
@@ -14,16 +14,10 @@
end
def all_subgroups
[self, subgroups].flatten.reject { |subgroup| subgroup.group_id.nil? }
end
-
- # Overridden in order to preserve the @group_id and @subgroups
- # Used by BaseGroup (which, in turn, is used by all Group objects)
- def *(int)
- self.class.new(super.to_s, group_id, subgroups)
- end
end
class SingleCharGroup
def initialize(char)
@char = char
@@ -118,11 +112,11 @@
# Generates the result of each contained group
# and adds the filled group of each result to
# itself
def result
strings = @groups.map {|repeater| repeater.result}
- RegexpExamples::permutations_of_strings(strings).map do |result|
+ RegexpExamples.permutations_of_strings(strings).map do |result|
GroupResult.new(result, group_id)
end
end
end
@@ -135,11 +129,11 @@
@right_repeaters = right_repeaters
end
def result
- left_result = RegexpExamples::map_results(@left_repeaters)
- right_result = RegexpExamples::map_results(@right_repeaters)
+ left_result = RegexpExamples.map_results(@left_repeaters)
+ right_result = RegexpExamples.map_results(@right_repeaters)
left_result.concat(right_result).flatten.uniq.map do |result|
GroupResult.new(result)
end
end
end