Class: SparkleMotion::LazyRequestConfig
- Inherits:
-
Object
- Object
- SparkleMotion::LazyRequestConfig
- Defined in:
- lib/sparkle_motion/lazy_request_config.rb
Overview
Evil hack to convince Curb to grab simulation-based information as late as possible, to undo the temporal skew that comes from updating the simulation then spending a bunch of time feeding updates to lights.
Constant Summary collapse
- GLOBAL_HISTORY =
[]
Instance Method Summary collapse
- #delete(field) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(logger, config, url, results = nil, debug: nil, &callback) ⇒ LazyRequestConfig
constructor
TODO: Transition should be updated late as well…
Constructor Details
#initialize(logger, config, url, results = nil, debug: nil, &callback) ⇒ LazyRequestConfig
TODO: Transition should be updated late as well…
8 9 10 11 12 13 14 15 16 |
# File 'lib/sparkle_motion/lazy_request_config.rb', line 8 def initialize(logger, config, url, results = nil, debug: nil, &callback) @logger = logger @config = config @url = url @results = results @callback = callback @fixed = create_fixed(url) @debug = debug end |
Instance Method Details
#delete(field) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sparkle_motion/lazy_request_config.rb', line 24 def delete(field) return @fixed[field] if @fixed.key?(field) if field == :put_data tmp = Oj.dump(@callback.call) journal("BEGIN", body: tmp) return tmp end @logger.error { "Request for unknown field: `#{field}`! Has Curb changed internally?" } nil end |
#each(&block) ⇒ Object
18 19 20 21 22 |
# File 'lib/sparkle_motion/lazy_request_config.rb', line 18 def each(&block) EASY_OPTIONS.each do |kv| block.call(kv) end end |