./lib/coderay/tokens.rb in coderay-0.4.3.48 vs ./lib/coderay/tokens.rb in coderay-0.4.5.73

- old
+ new

@@ -92,19 +92,18 @@ # Returns false. def stream? false end - alias :orig_each :each # Iterates over all tokens. # # If a filter is given, only tokens of that kind are yielded. def each kind_filter = nil, &block unless kind_filter - orig_each(&block) + super(&block) else - orig_each do |text, kind| + super do |text, kind| next unless kind == kind_filter yield text, kind end end end @@ -113,10 +112,10 @@ # Range tokens like [:open, :string] are left out. # # Example: # tokens.each_text_token { |text, kind| text.replace html_escape(text) } def each_text_token - orig_each do |text, kind| + each do |text, kind| next unless text.respond_to? :to_str yield text, kind end end