Class: Memories::VersionProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/memories/versions_proxy.rb

Direct Known Subclasses

MilestoneProxy

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc, version_number) ⇒ VersionProxy

Returns a new instance of VersionProxy.



57
58
59
60
# File 'lib/memories/versions_proxy.rb', line 57

def initialize(doc, version_number)
  @doc = doc
  @version_number = version_number
end

Instance Attribute Details

#version_numberObject (readonly)

Returns the value of attribute version_number.



55
56
57
# File 'lib/memories/versions_proxy.rb', line 55

def version_number
  @version_number
end

Instance Method Details

#instanceObject



74
75
76
# File 'lib/memories/versions_proxy.rb', line 74

def instance
  @instance ||= @doc.dup.revert_to @version_number
end

#milestone?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/memories/versions_proxy.rb', line 70

def milestone?
  @is_milestone ||= @doc.milestones.collect(&:version).include? version
end

#revisionObject



66
67
68
# File 'lib/memories/versions_proxy.rb', line 66

def revision
  version
end

#versionObject



62
63
64
# File 'lib/memories/versions_proxy.rb', line 62

def version
  @version ||= @doc.version_id @version_number
end