Class: Crystalball::MapGenerator::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#commitObject

Returns the value of attribute commit.



12
13
14
# File 'lib/crystalball/map_generator/configuration.rb', line 12

def commit
  @commit
end

#compact_mapObject

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_classObject



25
26
27
# File 'lib/crystalball/map_generator/configuration.rb', line 25

def map_class
  @map_class ||= ExecutionMap
end

#map_storageObject



37
38
39
# File 'lib/crystalball/map_generator/configuration.rb', line 37

def map_storage
  @map_storage ||= MapStorage::YAMLStorage.new(map_storage_path)
end

#strategiesObject (readonly)

Returns the value of attribute strategies.



14
15
16
# File 'lib/crystalball/map_generator/configuration.rb', line 14

def strategies
  @strategies
end

#versionObject

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

Returns:

  • (Boolean)


21
22
23
# File 'lib/crystalball/map_generator/configuration.rb', line 21

def compact_map?
  !!@compact_map
end

#dump_thresholdObject



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_pathObject



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