class ViewModel::Reference

Key to identify a viewmodel with some kind of inherent ID (e.g. an ViewModel::ActiveRecord)

Attributes

model_id[RW]
viewmodel_class[RW]

Public Class Methods

new(viewmodel_class, model_id) click to toggle source
# File lib/view_model/reference.rb, line 8
def initialize(viewmodel_class, model_id)
  @viewmodel_class = viewmodel_class
  @model_id        = model_id
end

Public Instance Methods

==(other) click to toggle source
# File lib/view_model/reference.rb, line 21
def ==(other)
  other.class             == self.class &&
    other.viewmodel_class == viewmodel_class &&
    other.model_id        == model_id
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/view_model/reference.rb, line 29
def hash
  [viewmodel_class, model_id].hash
end
inspect() click to toggle source
# File lib/view_model/reference.rb, line 17
def inspect
  "<Ref:#{self}>"
end
to_s() click to toggle source
# File lib/view_model/reference.rb, line 13
def to_s
  "'#{viewmodel_class.view_name}(id=#{model_id})'"
end