Class: RDGC::Util::Config
- Inherits:
-
Object
- Object
- RDGC::Util::Config
- Defined in:
- lib/rdgc/util/config.rb
Constant Summary collapse
- DEFAULT_CONFIG =
{ :min_room_size => 4 }
Class Method Summary collapse
- .get(key) ⇒ Object
- .min_block_size ⇒ Object
- .min_room_size ⇒ Object
- .reset! ⇒ Object
- .set(hash) ⇒ Object
- .seted? ⇒ Boolean
Class Method Details
.get(key) ⇒ Object
22 23 24 25 |
# File 'lib/rdgc/util/config.rb', line 22 def get(key) @config_hash ||= DEFAULT_CONFIG @config_hash[key] end |
.min_block_size ⇒ Object
41 42 43 44 |
# File 'lib/rdgc/util/config.rb', line 41 def min_block_size # デフォルトのblock最小値 = 最小部屋サイズ+上下空き2+接線通路分1 min_room_size + 3 end |
.min_room_size ⇒ Object
37 38 39 |
# File 'lib/rdgc/util/config.rb', line 37 def min_room_size get(:min_room_size) end |
.reset! ⇒ Object
31 32 33 34 35 |
# File 'lib/rdgc/util/config.rb', line 31 def reset! @config_hash = DEFAULT_CONFIG @seted = false true end |
.set(hash) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/rdgc/util/config.rb', line 12 def set(hash) return if seted? hash = DEFAULT_CONFIG.merge(hash) @config_hash = hash @seted = true true end |
.seted? ⇒ Boolean
27 28 29 |
# File 'lib/rdgc/util/config.rb', line 27 def seted? @seted ? true : false end |