Class: U3d::UnityModule

Inherits:
Object
  • Object
show all
Defined in:
lib/u3d/unity_module.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name: nil, description: nil, url: nil, installed_size: nil, download_size: nil, checksum: nil, os: nil, depends_on: nil, command: nil, destination: nil, rename_from: nil, rename_to: nil) ⇒ UnityModule

rubocop:disable Metrics/ParameterLists



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/u3d/unity_module.rb', line 35

def initialize(
  id:, name: nil, description: nil, url: nil,
  installed_size: nil, download_size: nil, checksum: nil,
  os: nil, depends_on: nil, command: nil, destination: nil, rename_from: nil, rename_to: nil
)
  @id = id.downcase
  @name = name
  @description = description
  @url = url
  @installed_size = installed_size
  @download_size = download_size
  @checksum = checksum
  @os = os
  @depends_on = depends_on
  @command = command
  @destination = destination
  @rename_from = rename_from
  @rename_to = rename_to
end

Instance Attribute Details

#checksumObject (readonly)

Validation attributes



30
31
32
# File 'lib/u3d/unity_module.rb', line 30

def checksum
  @checksum
end

#commandObject (readonly)

Internal attributes



32
33
34
# File 'lib/u3d/unity_module.rb', line 32

def command
  @command
end

#depends_onObject (readonly)

Internal attributes



32
33
34
# File 'lib/u3d/unity_module.rb', line 32

def depends_on
  @depends_on
end

#descriptionObject (readonly)

Basic module attributes



28
29
30
# File 'lib/u3d/unity_module.rb', line 28

def description
  @description
end

#destinationObject (readonly)

Internal attributes



32
33
34
# File 'lib/u3d/unity_module.rb', line 32

def destination
  @destination
end

#download_sizeObject (readonly)

Validation attributes



30
31
32
# File 'lib/u3d/unity_module.rb', line 30

def download_size
  @download_size
end

#idObject (readonly)

Basic module attributes



28
29
30
# File 'lib/u3d/unity_module.rb', line 28

def id
  @id
end

#installed_sizeObject (readonly)

Validation attributes



30
31
32
# File 'lib/u3d/unity_module.rb', line 30

def installed_size
  @installed_size
end

#nameObject (readonly)

Basic module attributes



28
29
30
# File 'lib/u3d/unity_module.rb', line 28

def name
  @name
end

#osObject (readonly)

Internal attributes



32
33
34
# File 'lib/u3d/unity_module.rb', line 32

def os
  @os
end

#rename_fromObject (readonly)

Internal attributes



32
33
34
# File 'lib/u3d/unity_module.rb', line 32

def rename_from
  @rename_from
end

#rename_toObject (readonly)

Internal attributes



32
33
34
# File 'lib/u3d/unity_module.rb', line 32

def rename_to
  @rename_to
end

#urlObject (readonly)

Basic module attributes



28
29
30
# File 'lib/u3d/unity_module.rb', line 28

def url
  @url
end

Class Method Details

.load_modules(version, cached_versions, os: U3dCore::Helper.operating_system, offline: false) ⇒ Object



64
65
66
67
68
69
70
71
72
# File 'lib/u3d/unity_module.rb', line 64

def load_modules(version, cached_versions, os: U3dCore::Helper.operating_system, offline: false)
  if version.is_a? Array
    UI.verbose "Loading modules for several versions: #{version}"
    load_versions_modules(version, cached_versions, os, offline)
  else
    UI.verbose "Loading modules for version #{version}"
    load_version_modules(version, cached_versions, os, offline)
  end
end

Instance Method Details

#depends_on?(other) ⇒ Boolean

rubocop:enable Metrics/ParameterLists

Returns:

  • (Boolean)


56
57
58
59
60
61
# File 'lib/u3d/unity_module.rb', line 56

def depends_on?(other)
  return true if other.id == 'unity'
  return false unless depends_on

  other.id == depends_on || other.name == depends_on
end