Sha256: 79d5e6c9076da899d2c5d648885e971554519a59af9144b81e963f31defe27fd

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 Bytes

Contents

#:enddoc:
module RailsConnector

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

  def obj_id
    @doc["obj_id"]
  end

  def workspace_id
    @doc["workspace_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

2 entries across 2 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.0.beta.200.650.7c93155 lib/rails_connector/version.rb
infopark_cloud_connector-6.8.0.beta.200.621.4c8e1b0 lib/rails_connector/version.rb