Class: Factorio::Mod::Download
- Inherits:
-
Struct
- Object
- Struct
- Factorio::Mod::Download
- Defined in:
- lib/factorio/mod/download.rb
Overview
store the entry of the download
Constant Summary collapse
- TABLE_HEADER_TO_SYM =
Download
page table header to attribute symbol { 'Version' => :version, 'Game Version' => :game_version, 'Download' => :uri, 'Release Date' => :date, 'Downloads' => :times }.freeze
- HANDLE_VALUE =
{ version: :text.to_proc, game_version: :text.to_proc, uri: Mod.method(:get_href).to_proc, date: :text.to_proc, times: :text.to_proc >> :to_i.to_proc }.freeze
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#game_version ⇒ Object
Returns the value of attribute game_version.
-
#times ⇒ Object
Returns the value of attribute times.
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#set(name, value) ⇒ Object
set value by table header.
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date
6 7 8 |
# File 'lib/factorio/mod/download.rb', line 6 def date @date end |
#game_version ⇒ Object
Returns the value of attribute game_version
6 7 8 |
# File 'lib/factorio/mod/download.rb', line 6 def game_version @game_version end |
#times ⇒ Object
Returns the value of attribute times
6 7 8 |
# File 'lib/factorio/mod/download.rb', line 6 def times @times end |
#uri ⇒ Object
Returns the value of attribute uri
6 7 8 |
# File 'lib/factorio/mod/download.rb', line 6 def uri @uri end |
#version ⇒ Object
Returns the value of attribute version
6 7 8 |
# File 'lib/factorio/mod/download.rb', line 6 def version @version end |
Instance Method Details
#set(name, value) ⇒ Object
set value by table header
25 26 27 28 |
# File 'lib/factorio/mod/download.rb', line 25 def set(name, value) sym = TABLE_HEADER_TO_SYM[name] tap { |a| a[sym] = HANDLE_VALUE[sym].call value } end |