lib/cureutils/cli.rb in cureutils-0.1.2 vs lib/cureutils/cli.rb in cureutils-0.1.3

- old
+ new

@@ -202,20 +202,17 @@ else Time.parse(updated_fmt) end end - desc 'pregex2regex', 'Convert string to precure regular expression' + # Convert string to precure regular expression def pregex2regex(regex, br_flg = false) this_regex = regex.dup br_ex = br_flg ? '' : '?:' %w(girl_name human_name precure_name cast_name color).each do |attr| expression = '\[:' + attr + ':\]' - precures_ex = cure_list(attr.to_sym).each do |elem_str| - # Escape for cure princes. - elem_str.gsub(/\(/, '\(').gsub(/\)/, '\)') - end.join('|') + precures_ex = cure_list(attr.to_sym).join('|') replaced = "(#{br_ex}#{precures_ex})" this_regex.gsub!(/#{expression}/, replaced) end this_regex end @@ -229,9 +226,14 @@ end def cure_list(sym) list = Precure.all_stars.map(&sym) list << Cure.echo[sym] + # Regulate cure princes human name + list.map do |str| + str.gsub!(/\(.+?\)/, '') + str + end list end def cure_table(to_sym, from_sym) to_arr = cure_list(to_sym)