Class: Fort::Src::Code::DependedModule

Inherits:
Object
  • Object
show all
Defined in:
lib/fort/src/code/depended_module.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, intrinsic_mode = nil) ⇒ DependedModule

Returns a new instance of DependedModule.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fort/src/code/depended_module.rb', line 7

def initialize(name, intrinsic_mode = nil)
  @name = name
  @intrinsic_mode = if intrinsic_mode.nil?
                      if ::Fort::INTRINSIC_MODULES.include?(name)
                        :both
                      else
                        :non_intrinsic
                      end
                    else
                      intrinsic_mode
                    end
  raise ArgumentError unless [:intrinsic, :non_intrinsic, :both].include?(@intrinsic_mode)
end

Instance Attribute Details

#intrinsic_modeObject (readonly)

Returns the value of attribute intrinsic_mode.



5
6
7
# File 'lib/fort/src/code/depended_module.rb', line 5

def intrinsic_mode
  @intrinsic_mode
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/fort/src/code/depended_module.rb', line 5

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
24
25
# File 'lib/fort/src/code/depended_module.rb', line 21

def ==(other)
  self.class == other.class\
  && @name == other.name\
  && @intrinsic_mode == other.intrinsic_mode
end

#eql?(other) ⇒ Boolean



27
28
29
# File 'lib/fort/src/code/depended_module.rb', line 27

def eql?(other)
  self.class == other.class && self.hash == other.hash
end

#hashObject



31
32
33
# File 'lib/fort/src/code/depended_module.rb', line 31

def hash
  [@name, @intrinsic_mode].hash
end