Class: KillerQueenSceneScoring::Base
- Inherits:
-
Object
- Object
- KillerQueenSceneScoring::Base
- Defined in:
- lib/killer_queen_scene_scoring/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#hash_of_arrays ⇒ Object
Creates a hash whose values are arrays.
-
#initialize(api_key, logger = nil) ⇒ Base
constructor
A new instance of Base.
- #log_debug(msg) ⇒ Object
- #log_error(msg) ⇒ Object
- #log_info(msg) ⇒ Object
- #log_warn(msg) ⇒ Object
Constructor Details
#initialize(api_key, logger = nil) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/killer_queen_scene_scoring/base.rb', line 8 def initialize(api_key, logger = nil) @api_key = api_key @logger = case logger when true Logger.new(STDOUT, progname: "KillerQueenSceneScoring") when Logger logger else nil end end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/killer_queen_scene_scoring/base.rb', line 6 def api_key @api_key end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
6 7 8 |
# File 'lib/killer_queen_scene_scoring/base.rb', line 6 def logger @logger end |
Instance Method Details
#hash_of_arrays ⇒ Object
Creates a hash whose values are arrays.
22 23 24 |
# File 'lib/killer_queen_scene_scoring/base.rb', line 22 def hash_of_arrays Hash.new { |h, k| h[k] = [] } end |
#log_debug(msg) ⇒ Object
26 27 28 |
# File 'lib/killer_queen_scene_scoring/base.rb', line 26 def log_debug(msg) @logger&.debug msg end |
#log_error(msg) ⇒ Object
38 39 40 |
# File 'lib/killer_queen_scene_scoring/base.rb', line 38 def log_error(msg) @logger&.error msg end |
#log_info(msg) ⇒ Object
30 31 32 |
# File 'lib/killer_queen_scene_scoring/base.rb', line 30 def log_info(msg) @logger&.info msg end |
#log_warn(msg) ⇒ Object
34 35 36 |
# File 'lib/killer_queen_scene_scoring/base.rb', line 34 def log_warn(msg) @logger&.warn msg end |