Module: HDLRuby::LowDB::Ltype
- Included in:
- Type, TypeFloat, TypeSigned, TypeStruct, TypeTuple, TypeUnsigned, TypeVector
- Defined in:
- lib/HDLRuby/hruby_db.rb
Overview
Module bringing low-level properties to types
Class Method Summary collapse
-
.included(base) ⇒ Object
Ensures initialize registers the type name and adds the get methods to the class.
Instance Method Summary collapse
-
#ltype? ⇒ Boolean
Tells ltype has been included.
Class Method Details
.included(base) ⇒ Object
Ensures initialize registers the type name and adds the get methods to the class
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/HDLRuby/hruby_db.rb', line 57 def self.included(base) # built-in Ruby hook for modules base.class_eval do original_method = instance_method(:initialize) define_method(:initialize) do |*args, &block| original_method.bind(self).call(*args, &block) # Update the library of existing types. # Note: no check is made so an exisiting type with a same # name is overwritten. Types[@name] = self end # Get an existing signal type by +name+. def self.get(name) # return name if name.is_a?(Type) return name if name.respond_to?(:ltype?) return Types[name.to_sym] end end end |
Instance Method Details
#ltype? ⇒ Boolean
Tells ltype has been included.
78 79 80 |
# File 'lib/HDLRuby/hruby_db.rb', line 78 def ltype? return true end |