[前][次][番号順一覧][スレッド一覧]

ruby-changes:66992

From: aycabta <ko1@a...>
Date: Fri, 30 Jul 2021 02:27:04 +0900 (JST)
Subject: [ruby-changes:66992] 0f496b9b29 (master): [ruby/reline] Define StringWithTiparm instead of singular method

https://git.ruby-lang.org/ruby.git/commit/?id=0f496b9b29

From 0f496b9b29a38cfe39710c96111549d387f73321 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Thu, 24 Jun 2021 18:04:02 +0900
Subject: [ruby/reline] Define StringWithTiparm instead of singular method

https://github.com/ruby/reline/commit/de234dc875
---
 lib/reline/terminfo.rb | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/reline/terminfo.rb b/lib/reline/terminfo.rb
index 53809c4..5c881a3 100644
--- a/lib/reline/terminfo.rb
+++ b/lib/reline/terminfo.rb
@@ -72,12 +72,14 @@ module Reline::Terminfo https://github.com/ruby/ruby/blob/trunk/lib/reline/terminfo.rb#L72
     end
   end
 
-  def self.tigetstr(capname)
-    result = @tigetstr.(capname).to_s
-    def result.tiparm(*args) # for method chain
+  class StringWithTiparm < String
+    def tiparm(*args) # for method chain
       Reline::Terminfo.tiparm(self, *args)
     end
-    result
+  end
+
+  def self.tigetstr(capname)
+    StringWithTiparm.new(@tigetstr.(capname).to_s)
   end
 
   def self.tiparm(str, *args)
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]