Class: Fort::Src::Code::ProgramUnit
- Inherits:
-
Object
- Object
- Fort::Src::Code::ProgramUnit
- Defined in:
- lib/fort/src/code/program_unit.rb
Instance Attribute Summary collapse
-
#deps ⇒ Object
Returns the value of attribute deps.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, type, deps = []) ⇒ ProgramUnit
constructor
A new instance of ProgramUnit.
Constructor Details
#initialize(name, type, deps = []) ⇒ ProgramUnit
Returns a new instance of ProgramUnit.
8 9 10 11 12 13 14 |
# File 'lib/fort/src/code/program_unit.rb', line 8 def initialize(name, type, deps = []) raise ArgumentError unless [:program, :module].include?(type) @name = name @type = type @deps = deps end |
Instance Attribute Details
#deps ⇒ Object
Returns the value of attribute deps.
6 7 8 |
# File 'lib/fort/src/code/program_unit.rb', line 6 def deps @deps end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/fort/src/code/program_unit.rb', line 5 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/fort/src/code/program_unit.rb', line 5 def type @type end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fort/src/code/program_unit.rb', line 16 def ==(other) self.class == other.class\ && @name == other.name\ && @type == other.type\ && @deps == other.deps end |
#eql?(other) ⇒ Boolean
23 24 25 |
# File 'lib/fort/src/code/program_unit.rb', line 23 def eql?(other) self.class == other.class && self.hash == other.hash end |
#hash ⇒ Object
27 28 29 |
# File 'lib/fort/src/code/program_unit.rb', line 27 def hash [@name, @intrinsic_mode].hash end |