Method: Tk::EncodedString#initialize
- Defined in:
- lib/tk/encodedstr.rb
#initialize(str, enc = nil) ⇒ EncodedString
Returns a new instance of EncodedString.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/tk/encodedstr.rb', line 68 def initialize(str, enc = nil) super(str) # @encoding = ( enc || # ((self.class::Encoding)? # self.class::Encoding : Tk.encoding_system) ) enc ||= (self.class::Encoding)? self.class::Encoding : ((Tk.encoding)? Tk.encoding : Tk.encoding_system) if TkCore::WITH_ENCODING unless encobj = Tk::Encoding::ENCODING_TABLE.get_obj(enc) fail ArgumentError, "unsupported Tk encoding '#{enc}'" end self.force_encoding(encobj) else @encoding = enc end end |