Class: Yeti::Viewer

Inherits:
Object
  • Object
show all
Defined in:
lib/yeti/viewer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, decorated) ⇒ Viewer

Returns a new instance of Viewer.



7
8
9
10
# File 'lib/yeti/viewer.rb', line 7

def initialize(context, decorated)
  @context = context
  @decorated = decorated
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'lib/yeti/viewer.rb', line 4

def context
  @context
end

#decoratedObject (readonly)

Returns the value of attribute decorated.



4
5
6
# File 'lib/yeti/viewer.rb', line 4

def decorated
  @decorated
end

Class Method Details

.from_id(context, id) ⇒ Object



12
13
14
# File 'lib/yeti/viewer.rb', line 12

def self.from_id(context, id)
  new context, (find_by_id context, id if id)
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



16
17
18
# File 'lib/yeti/viewer.rb', line 16

def ==(other)
  other.equal?(self) || (other.instance_of?(self.class) && other.id==id)
end

#hashObject



21
22
23
# File 'lib/yeti/viewer.rb', line 21

def hash
  id.hash
end