Class: String

Inherits:
Object show all
Defined in:
opal/browser/utils.rb,
opal/browser/css/unit.rb

Instance Method Summary collapse

Instance Method Details

#decode_uriString

Deprecated.

Please use FormData.decode_uri

Decode as URI.

Returns:

  • (String)

    the string decoded as URI


126
127
128
129
# File 'opal/browser/utils.rb', line 126

def decode_uri
  warn "opal-browser: String#decode_uri is deprecated. Please use FormData.decode_uri"
  FormData.decode_uri(self)
end

#decode_uri_componentString

Deprecated.

Please use FormData.decode

Decode as URI component.

Returns:

  • (String)

    the string decoded as URI component


117
118
119
120
# File 'opal/browser/utils.rb', line 117

def decode_uri_component
  warn "opal-browser: String#decode_uri_component is deprecated. Please use FormData.decode"
  FormData.decode(self)
end

#encode_uriString

Deprecated.

Please use FormData.encode_uri

Encode as URI.

Returns:

  • (String)

    the string encoded as URI


108
109
110
111
# File 'opal/browser/utils.rb', line 108

def encode_uri
  warn "opal-browser: String#encode_uri is deprecated. Please use FormData.encode_uri"
  FormData.encode_uri(self)
end

#encode_uri_componentString

Deprecated.

Please use FormData.encode

Encode as URI component.

Returns:

  • (String)

    the string encoded for usage as URI component


99
100
101
102
# File 'opal/browser/utils.rb', line 99

def encode_uri_component
  warn "opal-browser: String#encode_uri_component is deprecated. Please use FormData.encode"
  FormData.encode(self)
end

#to_uObject


169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'opal/browser/css/unit.rb', line 169

def to_u
  if matches = self.match(/^([\d+.]+)(.+)?$/)
    value = matches[1].to_f

    if unit = matches[2]
      value.__send__(unit.downcase)
    else
      value
    end
  else
    0
  end
end