Class: Manacle::ExampleList

Inherits:
Object
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/manacle/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExampleList

Returns a new instance of ExampleList.



65
66
67
# File 'lib/manacle/formatter.rb', line 65

def initialize
  @examples = []
end

Instance Attribute Details

#examplesObject (readonly)

Returns the value of attribute examples.



63
64
65
# File 'lib/manacle/formatter.rb', line 63

def examples
  @examples
end

Instance Method Details

#add(example, last_response) ⇒ Object



69
70
71
# File 'lib/manacle/formatter.rb', line 69

def add(example, last_response)
  @examples << Example.new(example, last_response)
end

#pretty_xml(xml) ⇒ Object



73
74
75
# File 'lib/manacle/formatter.rb', line 73

def pretty_xml(xml)
 Nokogiri::XML(xml,&:noblanks).to_xml unless xml.nil?
end

#renderObject



77
78
79
80
# File 'lib/manacle/formatter.rb', line 77

def render
  erb = ERB.new(File.read(File.expand_path('report.erb',__dir__)))
  erb.result(binding)
end