Class: RomLoader::GameRom

Inherits:
Object
  • Object
show all
Defined in:
lib/romloader/game_rom.rb

Overview

The class whose instances represent an individual game rom (e.g. Chrono Trigger object)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, rom_detail_url:) ⇒ GameRom

Create individual game rom objects from information scraped from freeroms.com, then sets the required name and rom_detail_url instance variables



11
12
13
14
# File 'lib/romloader/game_rom.rb', line 11

def initialize(name:, rom_detail_url:)
  @name = name
  @rom_detail_url = rom_detail_url
end

Instance Attribute Details

#download_urlObject (readonly)

Returns the value of attribute download_url.



7
8
9
# File 'lib/romloader/game_rom.rb', line 7

def download_url
  @download_url
end

#file_extObject (readonly)

Returns the value of attribute file_ext.



7
8
9
# File 'lib/romloader/game_rom.rb', line 7

def file_ext
  @file_ext
end

#filenameObject (readonly)

Returns the value of attribute filename.



7
8
9
# File 'lib/romloader/game_rom.rb', line 7

def filename
  @filename
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/romloader/game_rom.rb', line 6

def name
  @name
end

#rom_detail_urlObject (readonly)

Returns the value of attribute rom_detail_url.



7
8
9
# File 'lib/romloader/game_rom.rb', line 7

def rom_detail_url
  @rom_detail_url
end

#sizeObject (readonly)

Returns the value of attribute size.



7
8
9
# File 'lib/romloader/game_rom.rb', line 7

def size
  @size
end

#systemObject

Returns the value of attribute system.



6
7
8
# File 'lib/romloader/game_rom.rb', line 6

def system
  @system
end

Class Method Details

.create_collection(game_array) ⇒ Object

Creates an array of GameRom objects from an array



17
18
19
# File 'lib/romloader/game_rom.rb', line 17

def self.create_collection(game_array)
  game_array.collect {|game_details| self.new(game_details)}    
end

Instance Method Details

#set_rom_details(download_url: nil, size: nil, file_ext: nil, filename: nil) ⇒ Object

Sets all additional, optional rom details



22
23
24
25
26
27
28
# File 'lib/romloader/game_rom.rb', line 22

def set_rom_details(download_url: nil, size: nil, file_ext: nil, filename: nil)
  @download_url = download_url
  @size = size
  @file_ext = file_ext
  @filename = filename
  nil
end