Class: Oolite::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



118
119
120
# File 'lib/oolite.rb', line 118

def initialize
  reset
end

Instance Attribute Details

#cargoObject

Returns the value of attribute cargo.



110
111
112
# File 'lib/oolite.rb', line 110

def cargo
  @cargo
end

#contrabandObject

Returns the value of attribute contraband.



112
113
114
# File 'lib/oolite.rb', line 112

def contraband
  @contraband
end

#current_creditsObject

Returns the value of attribute current_credits.



109
110
111
# File 'lib/oolite.rb', line 109

def current_credits
  @current_credits
end

#current_system_nameObject

Returns the value of attribute current_system_name.



108
109
110
# File 'lib/oolite.rb', line 108

def current_system_name
  @current_system_name
end

#economiesObject

Returns the value of attribute economies.



113
114
115
# File 'lib/oolite.rb', line 113

def economies
  @economies
end

#governmentsObject

Returns the value of attribute governments.



114
115
116
# File 'lib/oolite.rb', line 114

def governments
  @governments
end

#market_data_filenameObject

Returns the value of attribute market_data_filename.



107
108
109
# File 'lib/oolite.rb', line 107

def market_data_filename
  @market_data_filename
end

#save_file_pathObject

Returns the value of attribute save_file_path.



106
107
108
# File 'lib/oolite.rb', line 106

def save_file_path
  @save_file_path
end

#systemsObject

Returns the value of attribute systems.



115
116
117
# File 'lib/oolite.rb', line 115

def systems
  @systems
end

#trade_contrabandObject

Returns the value of attribute trade_contraband.



111
112
113
# File 'lib/oolite.rb', line 111

def trade_contraband
  @trade_contraband
end

Instance Method Details

#encode_with(coder) ⇒ Object

Control which instance vars are emitted when dumped to YAML.

Example - not used at this time.


169
170
171
172
173
174
175
176
177
# File 'lib/oolite.rb', line 169

def encode_with(coder)
  vars = instance_variables.map { |x| x.to_s }
  vars = vars - ["@dummy"]

  vars.each do |var|
    var_val = eval(var)
    coder[var.gsub('@', '')] = var_val
  end
end

#resetObject



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/oolite.rb', line 122

def reset
  @save_file_path = ''

  @market_data_filename = 'oolite.market'

  @current_system_name = ''
  @current_credits = 0
  @cargo = 0

  @trade_contraband = false

  @contraband = [
    "Slaves",
    "Narcotics",
    "Firearms",
  ]

  @economies = [
    "Rich Industrial",
    "Average Industrial",
    "Poor Industrial",
    "Mainly Industrial",
    "Mainly Agricultural",
    "Rich Agricultural",
    "Average Agricultural",
    "Poor Agricultural"
  ]

  @governments = [
    "Anarchy",
    "Feudal",
    "Multi-Government",
    "Dictatorship",
    "Communist",
    "Confederacy",
    "Democracy",
    "Corporate State"
  ]

  @systems = Hash.new
end