Class: TeradataCli::SessionCharset
- Inherits:
-
Object
- Object
- TeradataCli::SessionCharset
- Defined in:
- lib/teradata-cli/utils.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #encoding ⇒ Object
-
#initialize(name) ⇒ SessionCharset
constructor
A new instance of SessionCharset.
Constructor Details
#initialize(name) ⇒ SessionCharset
Returns a new instance of SessionCharset.
58 59 60 |
# File 'lib/teradata-cli/utils.rb', line 58 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute name.
62 63 64 |
# File 'lib/teradata-cli/utils.rb', line 62 def name @name end |
Class Method Details
.intern(arg) ⇒ Object
54 55 56 |
# File 'lib/teradata-cli/utils.rb', line 54 def SessionCharset.intern(arg) arg.kind_of?(SessionCharset) ? arg : SessionCharset.new(arg.to_s) end |
Instance Method Details
#encoding ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/teradata-cli/utils.rb', line 66 def encoding case @name when /UTF8/i then Encoding::UTF_8 when /KANJISJIS_0S/i then Encoding::Windows_31J when /KANJIEUC_0U/i then Encoding::EUC_JP when /ASCII/i then Encoding::US_ASCII else raise ArgumentError, "could not convert session charset to encoding name: #{sc.inspect}" end end |