Conveniently turn a string into a tuple.

Methods
Included Modules
Public Class methods
cast_from(object, options={})
# File lib/facets/more/typecast.rb, line 154
    def cast_from(object, options={})
      retval = super
      return retval unless retval == nil
      return object.to_s if object.respond_to? :to_s
    end
json_create(o)

Raw Strings are JSON Objects (the raw bytes are stored in an array for the key "raw"). The Ruby String can be created by this class method.

# File lib/facets/more/json.rb, line 605
  def self.json_create(o)
    o['raw'].pack('C*')
  end
Public Instance methods
restore_snapshot(snap)
# File lib/facets/more/snapshot.rb, line 145
  def restore_snapshot(snap) replace(snap) end
take_snapshot()
# File lib/facets/more/snapshot.rb, line 144
  def take_snapshot() dup end
to_json(*)

This string should be encoded with UTF-8 (if JSON unicode support is enabled). A call to this method returns a JSON string encoded with UTF16 big endian characters as \u????. If JSON.support_unicode? is false only control characters are encoded this way, all 8-bit bytes are just passed through.

# File lib/facets/more/json.rb, line 599
  def to_json(*)
    '"' << JSON::utf8_to_json(self) << '"'
  end
to_json_raw(*args)

This method should be used, if you want to convert raw strings to JSON instead of UTF-8 strings, e. g. binary data (and JSON Unicode support is enabled).

# File lib/facets/more/json.rb, line 621
  def to_json_raw(*args)
    to_json_raw_object.to_json(*args)
  end
to_json_raw_object()

This method creates a raw object, that can be nested into other data structures and will be unparsed as a raw string.

# File lib/facets/more/json.rb, line 611
  def to_json_raw_object
    {
      'json_class'  => self.class.name,
      'raw'         => self.unpack('C*'),
    }
  end
to_t( &yld )
# File lib/facets/more/tuple.rb, line 249
  def to_t( &yld )
    Tuple.cast_from_string( self, &yld )
  end