Class: Stockshark::Configuration
- Inherits:
-
Object
- Object
- Stockshark::Configuration
- Defined in:
- lib/stockshark/configuration.rb
Overview
Environment-driven configuration — nothing here is ever a hardcoded, machine-specific path. Every value has a sensible default so the library works out of the box locally, but production is expected to set these explicitly (particularly STOCKFISH_PATH, since "stockfish" resolving via $PATH isn't guaranteed on every deploy target). Env var names stay STOCKFISH_* (not STOCKSHARK_*) deliberately — they configure the actual Stockfish (or Stockfish-compatible) binary being launched, which is a separate thing from what this gem happens to be called.
Instance Attribute Summary collapse
-
#hash_mb ⇒ Object
Returns the value of attribute hash_mb.
-
#max_analyze_ms ⇒ Object
Returns the value of attribute max_analyze_ms.
-
#path ⇒ Object
Returns the value of attribute path.
-
#threads ⇒ Object
Returns the value of attribute threads.
Instance Method Summary collapse
-
#initialize(path: ENV.fetch("STOCKFISH_PATH", "stockfish"), threads: Integer(ENV.fetch("STOCKFISH_THREADS", 1)), hash_mb: Integer(ENV.fetch("STOCKFISH_HASH", 16)), max_analyze_ms: Integer(ENV.fetch("STOCKFISH_MAX_ANALYZE_MS", 30_000))) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(path: ENV.fetch("STOCKFISH_PATH", "stockfish"), threads: Integer(ENV.fetch("STOCKFISH_THREADS", 1)), hash_mb: Integer(ENV.fetch("STOCKFISH_HASH", 16)), max_analyze_ms: Integer(ENV.fetch("STOCKFISH_MAX_ANALYZE_MS", 30_000))) ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/stockshark/configuration.rb', line 13 def initialize( path: ENV.fetch("STOCKFISH_PATH", "stockfish"), threads: Integer(ENV.fetch("STOCKFISH_THREADS", 1)), hash_mb: Integer(ENV.fetch("STOCKFISH_HASH", 16)), max_analyze_ms: Integer(ENV.fetch("STOCKFISH_MAX_ANALYZE_MS", 30_000)) ) @path = path @threads = threads @hash_mb = hash_mb @max_analyze_ms = max_analyze_ms end |
Instance Attribute Details
#hash_mb ⇒ Object
Returns the value of attribute hash_mb.
11 12 13 |
# File 'lib/stockshark/configuration.rb', line 11 def hash_mb @hash_mb end |
#max_analyze_ms ⇒ Object
Returns the value of attribute max_analyze_ms.
11 12 13 |
# File 'lib/stockshark/configuration.rb', line 11 def max_analyze_ms @max_analyze_ms end |
#path ⇒ Object
Returns the value of attribute path.
11 12 13 |
# File 'lib/stockshark/configuration.rb', line 11 def path @path end |
#threads ⇒ Object
Returns the value of attribute threads.
11 12 13 |
# File 'lib/stockshark/configuration.rb', line 11 def threads @threads end |