Sha256: ca2f4815b86785fa7d16e3a764dd37fc07135cd5069ae10d6b15feb83d554f44

Contents?: true

Size: 572 Bytes

Versions: 3

Compression:

Stored size: 572 Bytes

Contents

#:enddoc:
module RailsConnector

class Version
  def initialize(doc)
    @doc = doc
  end

  def obj_id
    @doc["obj_id"]
  end

  def workspace_id
    @doc["revision_id"]
  end

  def diff
    if @doc["content_cache_id"]
      case @doc["action"]
      when "D"
        0
      else # "N", "E"
        1
      end
    else
      @doc["diff"]
    end
  end

  def obj_data(patch_diff)
    data = patch_diff < 0 ? @doc["before"] : @doc["current"]
    data["obj_id"] = @doc["obj_id"]
    data["obj_type"] = @doc["obj_type"]

    data
  end
end

end # module RailsConnector

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.0.beta.200.713.e5c3150 lib/rails_connector/version.rb
infopark_cloud_connector-6.8.0.beta.200.681.7c84f4a lib/rails_connector/version.rb
infopark_cloud_connector-6.8.0.beta.200.663.ceecdee lib/rails_connector/version.rb