Class: Ritsu::ExternalLibrary

Inherits:
Object
  • Object
show all
Includes:
Utility::Accessors, Utility::InstanceSet
Defined in:
lib/ritsu/external_library.rb,
lib/ritsu/ext/cuda/external_library.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utility::InstanceSet

included, #initialize_instance

Methods included from Utility::Accessors

included

Constructor Details

#initialize(name, options = {}) ⇒ ExternalLibrary

Returns a new instance of ExternalLibrary.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ritsu/external_library.rb', line 20

def initialize(name, options={})
  options = {
    :cmake_name => '',
    :cmake_find_script => '',
    :cmake_depend_script => ''}.merge(options)
  @name = name
  @cmake_name = options[:cmake_name]
  @cmake_find_script = options[:cmake_find_script]
  @cmake_depend_script = options[:cmake_depend_script]
  ExternalLibrary.instances << self
end

Instance Attribute Details

#cmake_depend_scriptObject

Returns the value of attribute cmake_depend_script.



14
15
16
# File 'lib/ritsu/external_library.rb', line 14

def cmake_depend_script
  @cmake_depend_script
end

#cmake_find_scriptObject

Returns the value of attribute cmake_find_script.



13
14
15
# File 'lib/ritsu/external_library.rb', line 13

def cmake_find_script
  @cmake_find_script
end

#cmake_nameObject

Returns the value of attribute cmake_name.



12
13
14
# File 'lib/ritsu/external_library.rb', line 12

def cmake_name
  @cmake_name
end

#cuda_depend_scriptObject

Returns the value of attribute cuda_depend_script.



5
6
7
# File 'lib/ritsu/ext/cuda/external_library.rb', line 5

def cuda_depend_script
  @cuda_depend_script
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/ritsu/external_library.rb', line 11

def name
  @name
end

Class Method Details

.find_by_name(name) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/ritsu/external_library.rb', line 38

def self.find_by_name(name)
  instances.each do |instance|
    if instance.name == name
      return instance
    end
  end
  return nil
end

.validate_instance(instance) ⇒ Object



32
33
34
35
36
# File 'lib/ritsu/external_library.rb', line 32

def self.validate_instance(instance)
  if instances.select { |x| x.name == instance.name }.length > 0
    raise ArgumentError.new("external library with name '#{instance.name}' already exists")
  end
end

Instance Method Details

#initialize_before_cudaExternalLibrary

Returns a new instance of ExternalLibrary.

Returns:



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ritsu/ext/cuda/external_library.rb', line 8

def initialize(name, options={})
  options = {
    :cmake_name => '',
    :cmake_find_script => '',
    :cmake_depend_script => ''}.merge(options)
  @name = name
  @cmake_name = options[:cmake_name]
  @cmake_find_script = options[:cmake_find_script]
  @cmake_depend_script = options[:cmake_depend_script]
  ExternalLibrary.instances << self
end