Class: FactorioMods::Mod
- Inherits:
-
Object
- Object
- FactorioMods::Mod
- Defined in:
- lib/factorio_mods/mod.rb
Defined Under Namespace
Classes: MediaFile, Release, Tag
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#current_user_rating ⇒ Object
Returns the value of attribute current_user_rating.
-
#description ⇒ Object
Returns the value of attribute description.
-
#description_html ⇒ Object
Returns the value of attribute description_html.
-
#downloads_count ⇒ Object
Returns the value of attribute downloads_count.
-
#game_versions ⇒ Object
Returns the value of attribute game_versions.
-
#github_path ⇒ Object
Returns the value of attribute github_path.
-
#homepage ⇒ Object
Returns the value of attribute homepage.
-
#id ⇒ Object
Returns the value of attribute id.
-
#license_flags ⇒ Object
Returns the value of attribute license_flags.
-
#license_flags_raw ⇒ Object
readonly
Returns the value of attribute license_flags_raw.
-
#license_name ⇒ Object
Returns the value of attribute license_name.
-
#license_url ⇒ Object
Returns the value of attribute license_url.
-
#media_files ⇒ Object
Returns the value of attribute media_files.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#ratings_count ⇒ Object
Returns the value of attribute ratings_count.
-
#releases ⇒ Object
Returns the value of attribute releases.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#visits_count ⇒ Object
Returns the value of attribute visits_count.
Instance Method Summary collapse
- #first_media_file ⇒ Object
- #first_media_file=(file) ⇒ Object
-
#initialize(data = {}) ⇒ Mod
constructor
A new instance of Mod.
- #latest_release ⇒ Object
- #latest_release=(release) ⇒ Object
- #reload! ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ Mod
Returns a new instance of Mod.
91 92 93 94 95 |
# File 'lib/factorio_mods/mod.rb', line 91 def initialize(data = {}) data.each do |k, v| send "#{k}=".to_sym, v if respond_to? "#{k}=".to_sym end end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
88 89 90 |
# File 'lib/factorio_mods/mod.rb', line 88 def created_at @created_at end |
#current_user_rating ⇒ Object
Returns the value of attribute current_user_rating.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def end |
#description ⇒ Object
Returns the value of attribute description.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def description @description end |
#description_html ⇒ Object
Returns the value of attribute description_html.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def description_html @description_html end |
#downloads_count ⇒ Object
Returns the value of attribute downloads_count.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def downloads_count @downloads_count end |
#game_versions ⇒ Object
Returns the value of attribute game_versions.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def game_versions @game_versions end |
#github_path ⇒ Object
Returns the value of attribute github_path.
88 89 90 |
# File 'lib/factorio_mods/mod.rb', line 88 def github_path @github_path end |
#homepage ⇒ Object
Returns the value of attribute homepage.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def homepage @homepage end |
#id ⇒ Object
Returns the value of attribute id.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def id @id end |
#license_flags ⇒ Object
Returns the value of attribute license_flags.
88 89 90 |
# File 'lib/factorio_mods/mod.rb', line 88 def license_flags @license_flags end |
#license_flags_raw ⇒ Object (readonly)
Returns the value of attribute license_flags_raw.
88 89 90 |
# File 'lib/factorio_mods/mod.rb', line 88 def license_flags_raw @license_flags_raw end |
#license_name ⇒ Object
Returns the value of attribute license_name.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def license_name @license_name end |
#license_url ⇒ Object
Returns the value of attribute license_url.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def license_url @license_url end |
#media_files ⇒ Object
Returns the value of attribute media_files.
88 89 90 |
# File 'lib/factorio_mods/mod.rb', line 88 def media_files @media_files end |
#name ⇒ Object
Returns the value of attribute name.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def name @name end |
#owner ⇒ Object
Returns the value of attribute owner.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def owner @owner end |
#ratings_count ⇒ Object
Returns the value of attribute ratings_count.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def end |
#releases ⇒ Object
Returns the value of attribute releases.
88 89 90 |
# File 'lib/factorio_mods/mod.rb', line 88 def releases @releases end |
#summary ⇒ Object
Returns the value of attribute summary.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def summary @summary end |
#tags ⇒ Object
Returns the value of attribute tags.
88 89 90 |
# File 'lib/factorio_mods/mod.rb', line 88 def end |
#title ⇒ Object
Returns the value of attribute title.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def title @title end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
88 89 90 |
# File 'lib/factorio_mods/mod.rb', line 88 def updated_at @updated_at end |
#visits_count ⇒ Object
Returns the value of attribute visits_count.
84 85 86 |
# File 'lib/factorio_mods/mod.rb', line 84 def visits_count @visits_count end |
Instance Method Details
#first_media_file ⇒ Object
109 110 111 112 |
# File 'lib/factorio_mods/mod.rb', line 109 def first_media_file return media_files.first if media_files @first_media_file end |
#first_media_file=(file) ⇒ Object
114 115 116 |
# File 'lib/factorio_mods/mod.rb', line 114 def first_media_file=(file) @first_media_file = MediaFile.new file end |
#latest_release ⇒ Object
118 119 120 121 |
# File 'lib/factorio_mods/mod.rb', line 118 def latest_release return releases.max { |r| r.released_at.to_i } if releases @latest_release end |
#latest_release=(release) ⇒ Object
123 124 125 |
# File 'lib/factorio_mods/mod.rb', line 123 def latest_release=(release) @latest_release = Release.new release end |
#reload! ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/factorio_mods/mod.rb', line 97 def reload! data = FactorioMods::Api::ModPortal.raw_mod(name) data.each do |k, v| send "#{k}=".to_sym, v if respond_to? "#{k}=".to_sym end true end |