Class: String
- Defined in:
- opal/stdlib/json.rb,
opal/stdlib/native.rb,
opal/stdlib/encoding.rb
Instance Method Summary collapse
- #bytes ⇒ Object
- #bytesize ⇒ Object
- #each_byte(&block) ⇒ Object
- #encoding ⇒ Object
- #force_encoding(encoding) ⇒ Object
- #getbyte(idx) ⇒ Object
- #to_n ⇒ Object
Instance Method Details
#bytes ⇒ Object
130 131 132 |
# File 'opal/stdlib/encoding.rb', line 130 def bytes each_byte.to_a end |
#bytesize ⇒ Object
134 135 136 |
# File 'opal/stdlib/encoding.rb', line 134 def bytesize @encoding.bytesize(self) end |
#each_byte(&block) ⇒ Object
138 139 140 141 142 143 144 |
# File 'opal/stdlib/encoding.rb', line 138 def each_byte(&block) return enum_for :each_byte unless block_given? @encoding.each_byte(self, &block) self end |
#encoding ⇒ Object
146 147 148 |
# File 'opal/stdlib/encoding.rb', line 146 def encoding @encoding end |
#force_encoding(encoding) ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'opal/stdlib/encoding.rb', line 150 def force_encoding(encoding) encoding = Encoding.find(encoding) return self if encoding == @encoding %x{ var result = new String(self); result.encoding = encoding; return result; } end |
#getbyte(idx) ⇒ Object
163 164 165 |
# File 'opal/stdlib/encoding.rb', line 163 def getbyte(idx) @encoding.getbyte(self, idx) end |
#to_n ⇒ Object
375 376 377 |
# File 'opal/stdlib/native.rb', line 375 def to_n `self.valueOf()` end |