Sha256: 6fed68c74598285e7fa7c1680b44d808efe158e9617a296cfca50babca8c9918

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

# Extends core object with some conversion methods.

require 'rubyfox/sfsobject/bulk'
require 'rubyfox/sfsobject/schema'
require 'rubyfox/sfsobject/accessor'

class Hash
  def to_sfs(schema=:none)
    if schema == :none
      Rubyfox::SFSObject::Bulk.to_sfs(self)
    else
      Rubyfox::SFSObject::Schema.to_sfs(schema, self)
    end
  end
end

class Rubyfox::SFSObject::Java::SFSObject
  include Rubyfox::SFSObject::Accessor

  def to_hash(schema=:none)
    if schema == :none
      Rubyfox::SFSObject::Bulk.to_hash(self)
    else
      Rubyfox::SFSObject::Schema.to_hash(schema, self)
    end
  end

  def self.from_json(data)
    if data == "{}"
      new
    else
      new_from_json_data(data)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyfox-sfsobject-0.2.0-java lib/rubyfox/sfsobject/core_ext.rb