Class: Oolite::SystemData
- Inherits:
-
Object
- Object
- Oolite::SystemData
- Defined in:
- lib/oolite/system_data.rb
Instance Attribute Summary collapse
-
#economy ⇒ Object
Returns the value of attribute economy.
-
#government ⇒ Object
Returns the value of attribute government.
-
#name ⇒ Object
Returns the value of attribute name.
-
#tech_level ⇒ Object
Returns the value of attribute tech_level.
Instance Method Summary collapse
- #all_data_present? ⇒ Boolean
-
#initialize(name, data) ⇒ SystemData
constructor
A new instance of SystemData.
-
#to_yaml ⇒ Object
When emitting as YAML, emit as a hash.
Constructor Details
#initialize(name, data) ⇒ SystemData
Returns a new instance of SystemData.
15 16 17 18 19 20 21 22 |
# File 'lib/oolite/system_data.rb', line 15 def initialize name, data data = Hash(data) self.name = name self.economy = data[:economy] self.government = data[:government] self.tech_level = data[:tech_level] end |
Instance Attribute Details
#economy ⇒ Object
Returns the value of attribute economy.
13 14 15 |
# File 'lib/oolite/system_data.rb', line 13 def economy @economy end |
#government ⇒ Object
Returns the value of attribute government.
13 14 15 |
# File 'lib/oolite/system_data.rb', line 13 def government @government end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'lib/oolite/system_data.rb', line 13 def name @name end |
#tech_level ⇒ Object
Returns the value of attribute tech_level.
13 14 15 |
# File 'lib/oolite/system_data.rb', line 13 def tech_level @tech_level end |
Instance Method Details
#all_data_present? ⇒ Boolean
66 67 68 69 70 71 |
# File 'lib/oolite/system_data.rb', line 66 def all_data_present? return false if economy.nil? || economy.empty? return false if government.nil? || government.empty? return false if tech_level.nil? || tech_level.empty? return true end |
#to_yaml ⇒ Object
When emitting as YAML, emit as a hash
58 59 60 61 62 63 64 |
# File 'lib/oolite/system_data.rb', line 58 def to_yaml { economy: @economy, government: @government, tech_level: @tech_level, } end |