Class: DotDiff::Comparer
- Inherits:
-
Object
- Object
- DotDiff::Comparer
- Defined in:
- lib/dotdiff/comparer.rb
Instance Attribute Summary collapse
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#snapshot ⇒ Object
readonly
Returns the value of attribute snapshot.
Instance Method Summary collapse
-
#initialize(element, page, snapshot) ⇒ Comparer
constructor
A new instance of Comparer.
- #result ⇒ Object
Constructor Details
#initialize(element, page, snapshot) ⇒ Comparer
Returns a new instance of Comparer.
7 8 9 10 11 |
# File 'lib/dotdiff/comparer.rb', line 7 def initialize(element, page, snapshot) @page = page @element = element @snapshot = snapshot end |
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
5 6 7 |
# File 'lib/dotdiff/comparer.rb', line 5 def element @element end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
5 6 7 |
# File 'lib/dotdiff/comparer.rb', line 5 def page @page end |
#snapshot ⇒ Object (readonly)
Returns the value of attribute snapshot.
5 6 7 |
# File 'lib/dotdiff/comparer.rb', line 5 def snapshot @snapshot end |
Instance Method Details
#result ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/dotdiff/comparer.rb', line 13 def result if element.is_a?(::Session) DotDiff::Comparible::PageComparer.run(snapshot, nil) elsif element.is_a?(::Node::Base) DotDiff::Comparible::ElementComparer.run(snapshot, ElementMeta.new(page, element)) else raise ArgumentError, "Unknown element class received: #{element.class.name}" end end |