Class: Crystalball::MapGenerator::Configuration
- Inherits:
-
Object
- Object
- Crystalball::MapGenerator::Configuration
- Defined in:
- lib/crystalball/map_generator/configuration.rb
Overview
Configuration of map generator. Is can be accessed as a first argument inside ‘Crystalball::MapGenerator.start! { |config| config } block.
Instance Attribute Summary collapse
-
#commit ⇒ Object
Returns the value of attribute commit.
-
#compact_map ⇒ Object
Returns the value of attribute compact_map.
- #map_class ⇒ Object
- #map_storage ⇒ Object
-
#strategies ⇒ Object
readonly
Returns the value of attribute strategies.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #compact_map? ⇒ Boolean
- #dump_threshold ⇒ Object
- #dump_threshold=(value) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #map_storage_path ⇒ Object
- #map_storage_path=(value) ⇒ Object
-
#register(strategy) ⇒ Object
Register new strategy for map generation.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
16 17 18 19 |
# File 'lib/crystalball/map_generator/configuration.rb', line 16 def initialize @strategies = StrategiesCollection.new @compact_map = true end |
Instance Attribute Details
#commit ⇒ Object
Returns the value of attribute commit.
12 13 14 |
# File 'lib/crystalball/map_generator/configuration.rb', line 12 def commit @commit end |
#compact_map ⇒ Object
Returns the value of attribute compact_map.
12 13 14 |
# File 'lib/crystalball/map_generator/configuration.rb', line 12 def compact_map @compact_map end |
#map_class ⇒ Object
25 26 27 |
# File 'lib/crystalball/map_generator/configuration.rb', line 25 def map_class @map_class ||= ExecutionMap end |
#map_storage ⇒ Object
37 38 39 |
# File 'lib/crystalball/map_generator/configuration.rb', line 37 def map_storage @map_storage ||= MapStorage::YAMLStorage.new(map_storage_path) end |
#strategies ⇒ Object (readonly)
Returns the value of attribute strategies.
14 15 16 |
# File 'lib/crystalball/map_generator/configuration.rb', line 14 def strategies @strategies end |
#version ⇒ Object
Returns the value of attribute version.
12 13 14 |
# File 'lib/crystalball/map_generator/configuration.rb', line 12 def version @version end |
Instance Method Details
#compact_map? ⇒ Boolean
21 22 23 |
# File 'lib/crystalball/map_generator/configuration.rb', line 21 def compact_map? !!@compact_map end |
#dump_threshold ⇒ Object
41 42 43 |
# File 'lib/crystalball/map_generator/configuration.rb', line 41 def dump_threshold @dump_threshold ||= 100 end |
#dump_threshold=(value) ⇒ Object
45 46 47 |
# File 'lib/crystalball/map_generator/configuration.rb', line 45 def dump_threshold=(value) @dump_threshold = value.to_i end |
#map_storage_path ⇒ Object
29 30 31 |
# File 'lib/crystalball/map_generator/configuration.rb', line 29 def map_storage_path @map_storage_path ||= Pathname('tmp/crystalball_data.yml') end |
#map_storage_path=(value) ⇒ Object
33 34 35 |
# File 'lib/crystalball/map_generator/configuration.rb', line 33 def map_storage_path=(value) @map_storage_path = Pathname(value) end |
#register(strategy) ⇒ Object
Register new strategy for map generation
52 53 54 55 |
# File 'lib/crystalball/map_generator/configuration.rb', line 52 def register(strategy) @strategies.push strategy strategy.after_register end |