Sha256: ed95d544ee500eb67b2d7108a6ccc5e9c0574c404147788e109a73ce32c03ac9

Contents?: true

Size: 561 Bytes

Versions: 21

Compression:

Stored size: 561 Bytes

Contents

module RailsConnector

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

  def obj_id
    @doc["obj_id"]
  end

  def revision_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

21 entries across 21 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.0.322.c003f11 lib/rails_connector/version.rb