Class: CaDOVe::Reports::AttributeReport

Inherits:
Object
  • Object
show all
Defined in:
lib/cadove/models/reports/reports.rb

Instance Method Summary collapse

Constructor Details

#initialize(comparison, left_type, right_type) ⇒ AttributeReport

Returns a new instance of AttributeReport.



27
28
29
30
31
# File 'lib/cadove/models/reports/reports.rb', line 27

def initialize(comparison, left_type, right_type)
  @comparison = comparison
  @left_type = left_type
  @right_type = right_type
end

Instance Method Details

#displayObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/cadove/models/reports/reports.rb', line 33

def display
  puts Time.new.strftime('%b %d, %Y %H:%M:%S %Z')
  puts "\n"

  puts "########################"
  @comparison.intersecting_classes.each do |clazz|
    unless clazz.attributes.empty?
      puts ""
      puts "#{clazz.key.display}"
      puts ""
      puts "  #{header(@left_type)}   |   #{header(@right_type)}   | Attributes"
      puts "--------------------------------------"

      clazz.attributes.each do |a|
        puts "   #{a.left_match? ? 'X' : ' '}    |    #{a.right_match? ? 'X' : ' '}     | #{a.display}"  
      end
      puts ""
      puts "########################"  
    end
  end
end

#header(name) ⇒ Object



55
56
57
# File 'lib/cadove/models/reports/reports.rb', line 55

def header(name)
  name.to_s.upcase
end