Class: VhdlDoctest::DUT
- Inherits:
-
Object
- Object
- VhdlDoctest::DUT
- Defined in:
- lib/vhdl_doctest/dut.rb
Instance Attribute Summary collapse
-
#cases ⇒ Object
Returns the value of attribute cases.
-
#entity ⇒ Object
Returns the value of attribute entity.
-
#ports ⇒ Object
Returns the value of attribute ports.
Class Method Summary collapse
Instance Method Summary collapse
- #dependencies ⇒ Object
-
#initialize(vhdl) ⇒ DUT
constructor
A new instance of DUT.
- #port_block ⇒ Object
- #remove_comments(vhdl) ⇒ Object
- #test_file ⇒ Object
Constructor Details
#initialize(vhdl) ⇒ DUT
Returns a new instance of DUT.
8 9 10 |
# File 'lib/vhdl_doctest/dut.rb', line 8 def initialize(vhdl) @vhdl = vhdl end |
Instance Attribute Details
#cases ⇒ Object
Returns the value of attribute cases.
7 8 9 |
# File 'lib/vhdl_doctest/dut.rb', line 7 def cases @cases end |
#entity ⇒ Object
Returns the value of attribute entity.
7 8 9 |
# File 'lib/vhdl_doctest/dut.rb', line 7 def entity @entity end |
#ports ⇒ Object
Returns the value of attribute ports.
7 8 9 |
# File 'lib/vhdl_doctest/dut.rb', line 7 def ports @ports end |
Class Method Details
.parse(path) ⇒ Object
3 4 5 |
# File 'lib/vhdl_doctest/dut.rb', line 3 def self.parse(path) new(File.read(path)) end |
Instance Method Details
#dependencies ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/vhdl_doctest/dut.rb', line 46 def dependencies @vhdl.split("\n"). select { |line| line.include?('DOCTEST DEPENDENCIES') }. map { |line| line.split(":")[1].split(",") }. flatten. map { |file| file.strip } end |
#port_block ⇒ Object
30 31 32 |
# File 'lib/vhdl_doctest/dut.rb', line 30 def port_block @vhdl.match(/entity\s*(?<entity_name>[a-zA-Z_0-9]*)\s*is\s+port\s*\((?<ports>.*?)\);\s*end\s+\k<entity_name>\s*;/m)[:ports] end |
#remove_comments(vhdl) ⇒ Object
34 35 36 |
# File 'lib/vhdl_doctest/dut.rb', line 34 def remove_comments(vhdl) vhdl.gsub(/--.*$/, '') end |