Class: Fort::Src::Code::ProgramUnit
- Inherits:
-
Object
- Object
- Fort::Src::Code::ProgramUnit
- Extended by:
- RubyPatch::AutoLoad
- 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.
11 12 13 14 15 16 17 |
# File 'lib/fort/src/code/program_unit.rb', line 11 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.
9 10 11 |
# File 'lib/fort/src/code/program_unit.rb', line 9 def deps @deps end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/fort/src/code/program_unit.rb', line 8 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/fort/src/code/program_unit.rb', line 8 def type @type end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/fort/src/code/program_unit.rb', line 19 def ==(other) self.class == other.class\ && @name == other.name\ && @type == other.type\ && @deps == other.deps end |
#eql?(other) ⇒ Boolean
26 27 28 |
# File 'lib/fort/src/code/program_unit.rb', line 26 def eql?(other) self.class == other.class && self.hash == other.hash end |
#hash ⇒ Object
30 31 32 |
# File 'lib/fort/src/code/program_unit.rb', line 30 def hash [@name, @intrinsic_mode].hash end |