Class: RgGen::VHDL::Utility::DataObject

Inherits:
Object
  • Object
show all
Includes:
Core::Utility::AttributeSetter
Defined in:
lib/rggen/vhdl/utility/data_object.rb

Instance Method Summary collapse

Constructor Details

#initialize(object_type, default_attributes = {}) ⇒ DataObject

Returns a new instance of DataObject.



9
10
11
12
13
# File 'lib/rggen/vhdl/utility/data_object.rb', line 9

def initialize(object_type, default_attributes = {})
  @object_type = object_type
  apply_attributes(**default_attributes)
  block_given? && yield(self)
end

Instance Method Details

#declarationObject



22
23
24
25
26
27
# File 'lib/rggen/vhdl/utility/data_object.rb', line 22

def declaration
  declaration_snippets
    .compact
    .reject(&:empty?)
    .join(' ')
end

#identifierObject



29
30
31
32
33
34
# File 'lib/rggen/vhdl/utility/data_object.rb', line 29

def identifier
  Identifier.new(name) do |identifier|
    identifier.__width__(width)
    identifier.__array_size__(array_size)
  end
end